Merge branch 'js/log-remerge-keep-ancestry' into js/range-diff-diff-merges

* js/log-remerge-keep-ancestry:
  log: --remerge-diff needs to keep around commit parents
maint
Junio C Hamano 2024-12-16 08:45:14 -08:00
commit eb8374c652
2 changed files with 13 additions and 2 deletions

View File

@ -528,10 +528,14 @@ static int cmd_log_walk_no_free(struct rev_info *rev)
* but we didn't actually show the commit. * but we didn't actually show the commit.
*/ */
rev->max_count++; rev->max_count++;
if (!rev->reflog_info) { if (!rev->reflog_info && !rev->remerge_diff) {
/* /*
* We may show a given commit multiple times when * We may show a given commit multiple times when
* walking the reflogs. * walking the reflogs. Therefore we still need it.
*
* Likewise, we potentially still need the parents
* of * already shown commits to determine merge
* bases when showing remerge diffs.
*/ */
free_commit_buffer(the_repository->parsed_objects, free_commit_buffer(the_repository->parsed_objects,
commit); commit);

View File

@ -353,4 +353,11 @@ test_expect_success 'remerge-diff turns off history simplification' '
test_cmp expect actual test_cmp expect actual
' '


test_expect_success 'remerge-diff with --reverse' '
git log -1 --remerge-diff --oneline ab_resolution^ >expect &&
git log -1 --remerge-diff --oneline ab_resolution >>expect &&
git log -2 --remerge-diff --oneline ab_resolution --reverse >actual &&
test_cmp expect actual
'

test_done test_done