From 861788ae09316eb309b37f2f0fb51a0bb9b9a193 Mon Sep 17 00:00:00 2001 From: Martin von Zweigbergk Date: Fri, 21 Jul 2023 07:42:00 -0700 Subject: [PATCH] working_copy: propagate errors from failing to read conflict file --- lib/src/working_copy.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/src/working_copy.rs b/lib/src/working_copy.rs index d875b747e..4766cf470 100644 --- a/lib/src/working_copy.rs +++ b/lib/src/working_copy.rs @@ -864,7 +864,10 @@ impl TreeState { conflict_id: ConflictId, executable: bool, ) -> Result { - let mut file = File::open(disk_path).unwrap(); + let mut file = File::open(disk_path).map_err(|err| SnapshotError::IoError { + message: format!("Failed to open file {}", disk_path.display()), + err, + })?; let mut content = vec![]; file.read_to_end(&mut content).unwrap(); let conflict = self.store.read_conflict(repo_path, &conflict_id)?;