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

[BUGFIX PATCH 2/2] fast-export: use an unsorted string list for extra_refs

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Nov 23, 2008, 11:55 UTC
Message-ID
<alpine.DEB.1.00.0811231255380.30769@pacific.mpi-cbg.de>
In-Reply-To
<alpine.DEB.1.00.0811231254580.30769@pacific.mpi-cbg.de>

The list extra_refs contains tags and the objects referenced by them, so that they can be handled at the end. When a tag references a commit, that commit is added to the list using the same name.

Also, the function handle_tags_and_duplicates() relies on the order the items were added to extra_refs, so clearly we do not want to use a sorted list here.

Noticed by Miklos Vajna.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
	My bad.  Sorry.
 builtin-fast-export.c  |    4 ++--
 t/t9301-fast-export.sh |    2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/builtin-fast-export.c b/builtin-fast-export.c
index 7c93eb8..7d5d57a 100644
--- a/builtin-fast-export.c
+++ b/builtin-fast-export.c
@@ -354,7 +354,7 @@ static void get_tags_and_duplicates(struct object_array *pending,
 		case OBJ_TAG:
 			tag = (struct tag *)e->item;
 			while (tag && tag->object.type == OBJ_TAG) {
-				string_list_insert(full_name, extra_refs)->util = tag;
+				string_list_append(full_name, extra_refs)->util = tag;
 				tag = (struct tag *)tag->tagged;
 			}
 			if (!tag)
@@ -374,7 +374,7 @@ static void get_tags_and_duplicates(struct object_array *pending,
 		}
 		if (commit->util)
 			/* more than one name for the same object */
-			string_list_insert(full_name, extra_refs)->util = commit;
+			string_list_append(full_name, extra_refs)->util = commit;
 		else
 			commit->util = full_name;
 	}
diff --git a/t/t9301-fast-export.sh b/t/t9301-fast-export.sh
index 9af50b5..2057435 100755
--- a/t/t9301-fast-export.sh
+++ b/t/t9301-fast-export.sh
@@ -231,7 +231,7 @@ test_expect_success 'fast-export -C -C | fast-import' '
 
 '
 
-test_expect_failure 'fast-export | fast-import when master is tagged' '
+test_expect_success 'fast-export | fast-import when master is tagged' '
 
 	git tag -m msg last &&
 	git fast-export -C -C --signed-tags=strip --all > output &&
-- 
1.6.0.2.749.g0cc32
Previous: Johannes SchindelinNext: Miklos Vajna
Message 4 of 6 in “git fast-export problem with tags”
  1. Miklos VajnaNov 22, 2008
  2. Add new testcase to show fast-export does not always exports all tagsMiklos Vajna, Nov 22, 2008
  3. 1/2 Simplify and fix t9301Johannes Schindelin, Nov 23, 2008
  4. 2/2 fast-export: use an unsorted string list for extra_refsJohannes Schindelin, Nov 23, 2008
  5. Miklos VajnaNov 23, 2008
  6. Junio C HamanoNov 24, 2008

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.