]> git.ipfire.org Git - thirdparty/git.git/commitdiff
fast-export: avoid importing blob marks
authorFelipe Contreras <felipe.contreras@gmail.com>
Sat, 24 Nov 2012 03:17:01 +0000 (04:17 +0100)
committerJunio C Hamano <gitster@pobox.com>
Mon, 26 Nov 2012 19:05:12 +0000 (11:05 -0800)
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>
builtin/fast-export.c
t/t9350-fast-export.sh

index 12220ad8dac65acaa556c6524310d5540709f324..9b70ec1fcffacadccedcd6533ca44e68fefd9cf4 100644 (file)
@@ -614,6 +614,10 @@ static void import_marks(char *input_file)
                if (object->flags & SHOWN)
                        error("Object %s already has a mark", sha1_to_hex(sha1));
 
+               if (object->type != OBJ_COMMIT)
+                       /* only commits */
+                       continue;
+
                mark_object(object, mark);
                if (last_idnum < mark)
                        last_idnum = mark;
index 3e821f958bf10afc739e014ed854254a625affd9..5948b65f21eb1119d724c36452b3437c7ab83093 100755 (executable)
@@ -440,4 +440,18 @@ test_expect_success 'fast-export quotes pathnames' '
        )
 '
 
+test_expect_success 'test bidirectionality' '
+       >marks-cur &&
+       >marks-new &&
+       git init marks-test &&
+       git fast-export --export-marks=marks-cur --import-marks=marks-cur --branches | \
+       git --git-dir=marks-test/.git fast-import --export-marks=marks-new --import-marks=marks-new &&
+       (cd marks-test &&
+       git reset --hard &&
+       echo Wohlauf > file &&
+       git commit -a -m "back in time") &&
+       git --git-dir=marks-test/.git fast-export --export-marks=marks-new --import-marks=marks-new --branches | \
+       git fast-import --export-marks=marks-cur --import-marks=marks-cur
+'
+
 test_done