diff --git a/cli/src/diff_util.rs b/cli/src/diff_util.rs index 3d95482cd..4d23fe0f7 100644 --- a/cli/src/diff_util.rs +++ b/cli/src/diff_util.rs @@ -352,12 +352,6 @@ fn diff_content( let target = repo.store().read_symlink(path, id)?; Ok(target.into_bytes()) } - TreeValue::Tree(_) => { - panic!( - "Got an unexpected tree in a diff of path {}", - path.to_internal_file_string() - ); - } TreeValue::GitSubmodule(id) => { Ok(format!("Git submodule checked out at {}", id.hex()).into_bytes()) } @@ -367,6 +361,9 @@ fn diff_content( conflicts::materialize(&conflict, repo.store(), path, &mut content).unwrap(); Ok(content) } + TreeValue::Tree(_) => { + panic!("Unexpected {value:?} in diff at path {path:?}",); + } } } @@ -506,12 +503,6 @@ fn git_diff_part( let target = repo.store().read_symlink(path, id)?; content = target.into_bytes(); } - TreeValue::Tree(_) => { - panic!( - "Got an unexpected tree in a diff of path {}", - path.to_internal_file_string() - ); - } TreeValue::GitSubmodule(id) => { // TODO: What should we actually do here? mode = "040000".to_string(); @@ -523,6 +514,9 @@ fn git_diff_part( let conflict = repo.store().read_conflict(path, id).unwrap(); conflicts::materialize(&conflict, repo.store(), path, &mut content).unwrap(); } + TreeValue::Tree(_) => { + panic!("Unexpected {value:?} in diff at path {path:?}"); + } } let hash = hash[0..10].to_string(); Ok(GitDiffPart { @@ -896,6 +890,6 @@ fn diff_summary_char(value: Option<&TreeValue>) -> char { Some(TreeValue::Symlink(_)) => 'L', Some(TreeValue::GitSubmodule(_)) => 'G', Some(TreeValue::Conflict(_)) => 'C', - Some(TreeValue::Tree(_)) => panic!("unexpected tree entry in diff"), + Some(TreeValue::Tree(_)) => panic!("Unexpected {value:?} in diff"), } }