Skip to content

Commit ad3207e

Browse files
committed
Merge branch 'ma/fast-export-skip-merge-fix'
"git fast-export" had a regression in v2.15.0 era where it skipped some merge commits in certain cases, which has been corrected. * ma/fast-export-skip-merge-fix: fast-export: fix regression skipping some merge-commits
2 parents df7abe3 + be011bb commit ad3207e

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-1
lines changed

builtin/fast-export.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -651,8 +651,11 @@ static void handle_tail(struct object_array *commits, struct rev_info *revs,
651651
struct commit *commit;
652652
while (commits->nr) {
653653
commit = (struct commit *)object_array_pop(commits);
654-
if (has_unshown_parent(commit))
654+
if (has_unshown_parent(commit)) {
655+
/* Queue again, to be handled later */
656+
add_object_array(&commit->object, NULL, commits);
655657
return;
658+
}
656659
handle_commit(commit, revs, paths_of_changed_objects);
657660
}
658661
}

t/t9350-fast-export.sh

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -538,4 +538,22 @@ test_expect_success 'when using -C, do not declare copy when source of copy is a
538538
test_cmp expected actual
539539
'
540540

541+
test_expect_success 'merge commit gets exported with --import-marks' '
542+
test_create_repo merging &&
543+
(
544+
cd merging &&
545+
test_commit initial &&
546+
git checkout -b topic &&
547+
test_commit on-topic &&
548+
git checkout master &&
549+
test_commit on-master &&
550+
test_tick &&
551+
git merge --no-ff -m Yeah topic &&
552+
553+
echo ":1 $(git rev-parse HEAD^^)" >marks &&
554+
git fast-export --import-marks=marks master >out &&
555+
grep Yeah out
556+
)
557+
'
558+
541559
test_done

0 commit comments

Comments
 (0)