diff_util: don't panic for file hashes < 10 hex chars

This commit is contained in:
dploch 2024-06-05 15:45:22 -04:00 committed by Daniel Ploch
parent 9fb5307b78
commit 539edad216

View file

@ -638,7 +638,7 @@ fn git_diff_part(
value: MaterializedTreeValue,
) -> Result<GitDiffPart, DiffRenderError> {
let mode;
let hash;
let mut hash;
let mut contents: Vec<u8>;
match value {
MaterializedTreeValue::Absent => {
@ -693,7 +693,7 @@ fn git_diff_part(
panic!("Unexpected tree in diff at path {path:?}");
}
}
let hash = hash[0..10].to_string();
hash.truncate(10);
Ok(GitDiffPart {
mode,
hash,