fast-export: avoid importing blob marks

We want to be able to import, and then export, using the same marks, so that we don't push things that the other side already received. Unfortunately, fast-export doesn't store blobs in the marks, but fast-import does. This creates a mismatch when fast export is reusing a mark that was previously stored by fast-import. There is no point in one tool saving blobs, and the other not, but for now let's just check in fast-export that the objects are indeed commits. Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Felipe Contreras committed Nov 24, 2012 at 04:17 UTC 5d3698ffb4ccf8b842814559007e011fc409650b
2 files changed +18
builtin/fast-export.c
+4
@@ -614,6 +614,10 @@ static void import_marks(char *input_file)
614 if (object->flags & SHOWN)
615 error("Object %s already has a mark", sha1_to_hex(sha1));
616
617 + if (object->type != OBJ_COMMIT)
618 + /* only commits */
619 + continue;
620 +
621 mark_object(object, mark);
622 if (last_idnum < mark)
623 last_idnum = mark;
t/t9350-fast-export.sh
+14
@@ -440,4 +440,18 @@ test_expect_success 'fast-export quotes pathnames' '
440 )
441 '
442
443 +test_expect_success 'test bidirectionality' '
444 + >marks-cur &&
445 + >marks-new &&
446 + git init marks-test &&
447 + git fast-export --export-marks=marks-cur --import-marks=marks-cur --branches | \
448 + git --git-dir=marks-test/.git fast-import --export-marks=marks-new --import-marks=marks-new &&
449 + (cd marks-test &&
450 + git reset --hard &&
451 + echo Wohlauf > file &&
452 + git commit -a -m "back in time") &&
453 + git --git-dir=marks-test/.git fast-export --export-marks=marks-new --import-marks=marks-new --branches | \
454 + git fast-import --export-marks=marks-cur --import-marks=marks-cur
455 +'
456 +
457 test_done