Skip to content

Commit e980b2f

Browse files
committed
fix(git): Don't panic on conflict
Unsure what the case is where there isn't a `ours` or `theirs`. Fixes #95
1 parent 68f5447 commit e980b2f

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/git/repo.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,8 @@ impl GitRepo {
327327
.as_ref()
328328
.map(|c| bytes2path(&c.path))
329329
.or_else(|| conflict.their.as_ref().map(|c| bytes2path(&c.path)))
330-
.unwrap();
330+
.or_else(|| conflict.ancestor.as_ref().map(|c| bytes2path(&c.path)))
331+
.unwrap_or_else(|| std::path::Path::new("<unknown>"));
331332
format!("{}", our_path.display())
332333
})
333334
.join("\n ");
@@ -399,7 +400,8 @@ impl GitRepo {
399400
.as_ref()
400401
.map(|c| bytes2path(&c.path))
401402
.or_else(|| conflict.their.as_ref().map(|c| bytes2path(&c.path)))
402-
.unwrap();
403+
.or_else(|| conflict.ancestor.as_ref().map(|c| bytes2path(&c.path)))
404+
.unwrap_or_else(|| std::path::Path::new("<unknown>"));
403405
format!("{}", our_path.display())
404406
})
405407
.join("\n ");

0 commit comments

Comments
 (0)