Merge pull request #5171 from gitbutlerapp/Fix-rebasers

Fix issue where incoming commit headers were caried into merge commit headers
This commit is contained in:
Kiril Videlov 2024-10-16 17:33:11 +02:00 committed by GitHub
commit e587ee3dde
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -288,24 +288,19 @@ pub fn gitbutler_merge_commits<'repository>(
tree_oid = merged_index.write_tree_to(repository)?;
}
let commit_headers = incoming_commit
.gitbutler_headers()
.or_else(|| Some(Default::default()))
.map(|commit_headers| {
let conflicted_file_count = conflicted_files.total_entries() as u64;
let conflicted_file_count = conflicted_files.total_entries() as u64;
if conflicted_file_count > 0 {
CommitHeadersV2 {
conflicted: Some(conflicted_file_count),
..commit_headers
}
} else {
CommitHeadersV2 {
conflicted: None,
..commit_headers
}
}
});
let commit_headers = if conflicted_file_count > 0 {
CommitHeadersV2 {
conflicted: Some(conflicted_file_count),
..Default::default()
}
} else {
CommitHeadersV2 {
conflicted: None,
..Default::default()
}
};
let (author, committer) = repository.signatures()?;
@ -322,7 +317,7 @@ pub fn gitbutler_merge_commits<'repository>(
.find_tree(tree_oid)
.context("failed to find tree")?,
&[&target_commit, &incoming_commit],
commit_headers,
Some(commit_headers),
)
.context("failed to create commit")?;