ok/jj
1
0
Fork 0
forked from mirrors/jj

git_backend: generate change id from git2::Commit object

I'm going to extract a helper function that converts git2::Commit to
backend::Commit struct, and the commit id can also be obtained from the
git2::Commit object.
This commit is contained in:
Yuya Nishihara 2023-05-20 17:32:49 +09:00
parent 5dba0502cb
commit 0149e7b311

View file

@ -463,7 +463,7 @@ impl Backend for GitBackend {
// leading 16 bytes to address that. We also reverse the bits to make it less
// likely that users depend on any relationship between the two ids.
let change_id = ChangeId::new(
id.as_bytes()[4..HASH_LENGTH]
commit.id().as_bytes()[4..HASH_LENGTH]
.iter()
.rev()
.map(|b| b.reverse_bits())