33pub struct CommitDetails {
44 /// The fully decoded commit.
55 pub commit : crate :: CommitOwned ,
6- /// The changes between the tree of the first parent and this commit.
7- pub diff_with_first_parent : Vec < crate :: TreeChange > ,
6+ /// The changes between the tree of the first parent and this commit, or the merge-base between
7+ /// all parents of this commit and this commit if it's a merge-commit.
8+ pub changes : Vec < crate :: TreeChange > ,
89 /// The stats of the changes, which are computed only when explicitly requested.
910 pub line_stats : Option < LineStats > ,
1011 /// Represents what was causing a particular commit to conflict when rebased.
@@ -30,7 +31,8 @@ impl CommitDetails {
3031 pub fn from_commit_id ( commit_id : gix:: Id , line_stats : bool ) -> anyhow:: Result < Self > {
3132 let repo = commit_id. repo ;
3233 let commit = repo. find_commit ( commit_id) ?;
33- let first_parent_commit_id = commit. parent_ids ( ) . map ( |id| id. detach ( ) ) . next ( ) ;
34+ let first_parent_commit_id =
35+ super :: diff_base_commit_id ( repo, commit. parent_ids ( ) . map ( |id| id. detach ( ) ) ) ?;
3436
3537 let changes =
3638 crate :: diff:: TreeChanges :: from_trees ( repo, first_parent_commit_id, commit_id. detach ( ) ) ?;
@@ -42,7 +44,7 @@ impl CommitDetails {
4244 let conflict_entries = commit. conflict_entries ( ) ?;
4345 Ok ( CommitDetails {
4446 commit : commit. detach ( ) ,
45- diff_with_first_parent : changes. into_tree_changes ( ) ,
47+ changes : changes. into_tree_changes ( ) ,
4648 line_stats : line_stats. map ( Into :: into) ,
4749 conflict_entries,
4850 } )
0 commit comments