Skip to content

Commit

Permalink
fast-export: avoid importing blob marks
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Felipe Contreras authored and Junio C Hamano committed Nov 26, 2012
1 parent 3a189da commit 5d3698f
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
4 changes: 4 additions & 0 deletions builtin/fast-export.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
14 changes: 14 additions & 0 deletions t/t9350-fast-export.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 5d3698f

Please sign in to comment.