git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH v7 p1 01/13] fast-export: avoid importing blob marks

From
Felipe Contreras <felipe.contreras@gmail.com>
Date
Nov 28, 2012, 22:10 UTC
Message-ID
<1354140669-23533-2-git-send-email-felipe.contreras@gmail.com>
In-Reply-To
<1354140669-23533-1-git-send-email-felipe.contreras@gmail.com>

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  |  4 ++++
 t/t9350-fast-export.sh | 14 ++++++++++++++
 2 files changed, 18 insertions(+)
diff --git a/builtin/fast-export.c b/builtin/fast-export.c
index 12220ad..9b70ec1 100644
--- a/builtin/fast-export.c
+++ b/builtin/fast-export.c
@@ -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;
diff --git a/t/t9350-fast-export.sh b/t/t9350-fast-export.sh
index 3e821f9..5948b65 100755
--- a/t/t9350-fast-export.sh
+++ b/t/t9350-fast-export.sh
@@ -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
-- 
1.8.0.1
Previous: Felipe ContrerasNext: Felipe Contreras
Message 2 of 16 in “fast-export and remote-testgit improvements”
  1. 00/13 fast-export and remote-testgit improvementsFelipe Contreras, Nov 28, 2012
  2. 01/13 fast-export: avoid importing blob marksFelipe Contreras, Nov 28, 2012
  3. 02/13 remote-testgit: fix direction of marksFelipe Contreras, Nov 28, 2012
  4. 03/13 remote-helpers: fix failure messageFelipe Contreras, Nov 28, 2012
  5. 04/13 Rename git-remote-testgit to git-remote-testpyFelipe Contreras, Nov 28, 2012
  6. 05/13 Add new simplified git-remote-testgitFelipe Contreras, Nov 28, 2012
  7. 06/13 remote-testgit: remove non-local functionalityFelipe Contreras, Nov 28, 2012
  8. 07/13 remote-testgit: remove irrelevant testFelipe Contreras, Nov 28, 2012
  9. Pete WyckoffDec 3, 2012
  10. Felipe ContrerasDec 4, 2012
  11. 08/13 remote-testgit: cleanup testsFelipe Contreras, Nov 28, 2012
  12. 09/13 remote-testgit: exercise more featuresFelipe Contreras, Nov 28, 2012
  13. 10/13 remote-testgit: report success after an importFelipe Contreras, Nov 28, 2012
  14. 11/13 remote-testgit: implement the "done" feature manuallyFelipe Contreras, Nov 28, 2012
  15. 12/13 fast-export: trivial cleanupFelipe Contreras, Nov 28, 2012
  16. 13/13 fast-export: fix comparison in testsFelipe Contreras, Nov 28, 2012

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.