path: root/t/
diff options
authorMartin Ågren <>2018-04-20 22:12:31 (GMT)
committerJunio C Hamano <>2018-04-21 03:43:40 (GMT)
commitbe011bbe001facf71bd636494eb253aa5151d26a (patch)
treefd5252a98f4a1d79c5a73213edc6a88f0e4a1fc1 /t/
parentd32eb83c1db7d0a8bb54fe743c6d1dd674d372c5 (diff)
fast-export: fix regression skipping some merge-commits
7199203937 (object_array: add and use `object_array_pop()`, 2017-09-23) noted that the pattern `object = array.objects[].item` could be abstracted as `object = object_array_pop(&array)`. Unfortunately, one of the conversions was horribly wrong. Between grabbing the last object (i.e., peeking at it) and decreasing the object count, the original code would sometimes return early. The updated code on the other hand, will always pop the last element, then maybe do the early return without doing anything with the object. The end result is that merge commits where all the parents have still not been exported will simply be dropped, meaning that they will be completely missing from the exported data. Re-add a commit when it is not yet time to handle it. An alternative that was considered was to peek-then-pop. That carries some risk with it since the peeking and popping need to act on the same object, in a concerted fashion. Add a test that would have caught this. Reported-by: Isaac Chou <> Analyzed-by: Isaac Chou <> Helped-by: Johannes Schindelin <> Signed-off-by: Martin Ågren <> Signed-off-by: Junio C Hamano <>
Diffstat (limited to 't/')
1 files changed, 18 insertions, 0 deletions
diff --git a/t/ b/t/
index 866ddf6..c699c88 100755
--- a/t/
+++ b/t/
@@ -540,4 +540,22 @@ test_expect_success 'when using -C, do not declare copy when source of copy is a
test_cmp expected actual
+test_expect_success 'merge commit gets exported with --import-marks' '
+ test_create_repo merging &&
+ (
+ cd merging &&
+ test_commit initial &&
+ git checkout -b topic &&
+ test_commit on-topic &&
+ git checkout master &&
+ test_commit on-master &&
+ test_tick &&
+ git merge --no-ff -m Yeah topic &&
+ echo ":1 $(git rev-parse HEAD^^)" >marks &&
+ git fast-export --import-marks=marks master >out &&
+ grep Yeah out
+ )