git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* git fast-export problem with tags
@ 2008-11-22  2:29 Miklos Vajna
  2008-11-22 18:22 ` [PATCH] Add new testcase to show fast-export does not always exports all tags Miklos Vajna
  0 siblings, 1 reply; 6+ messages in thread
From: Miklos Vajna @ 2008-11-22  2:29 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: git

[-- Attachment #1: Type: text/plain, Size: 530 bytes --]

Hi Johannes,

It seems in some cases the tag messages of annotated tags are not
exported. Here is a reproducer:

git init
echo a > file
git add file
git commit -m i
git tag -a -m "one dot zero" 1.0

Now the output of 'git fast-export --all' does not contain the "one dot
zero" message.

But if you go a bit futher and make master point to a commit different
to the tag:

echo b > file
git add file
git commit -m b

then the output of 'git fast-export --all' clearly has it.

Is this a bug or have I missed something? ;-)

Thanks.

[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH] Add new testcase to show fast-export does not always exports all tags
  2008-11-22  2:29 git fast-export problem with tags Miklos Vajna
@ 2008-11-22 18:22 ` Miklos Vajna
  2008-11-23 11:55   ` [PATCH 1/2] Simplify and fix t9301 Johannes Schindelin
  0 siblings, 1 reply; 6+ messages in thread
From: Miklos Vajna @ 2008-11-22 18:22 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: git

Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
---

Here is a testcase for the bug I mentioned.

 t/t9301-fast-export.sh |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/t/t9301-fast-export.sh b/t/t9301-fast-export.sh
index 6ddd7c1..078832f 100755
--- a/t/t9301-fast-export.sh
+++ b/t/t9301-fast-export.sh
@@ -231,4 +231,15 @@ test_expect_success 'fast-export -C -C | fast-import' '
 
 '
 
+test_expect_failure 'fast-export | fast-import when master is tagged' '
+
+	git tag -m msg last &&
+	rm -rf new &&
+	mkdir new &&
+	git --git-dir=new/.git init &&
+	git fast-export -C -C --signed-tags=strip --all > output &&
+	test $(grep -c "^tag" output) = 3
+
+'
+
 test_done
-- 
1.6.0.4.770.gf38d.dirty

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 1/2] Simplify and fix t9301
  2008-11-22 18:22 ` [PATCH] Add new testcase to show fast-export does not always exports all tags Miklos Vajna
@ 2008-11-23 11:55   ` Johannes Schindelin
  2008-11-23 11:55     ` [BUGFIX PATCH 2/2] fast-export: use an unsorted string list for extra_refs Johannes Schindelin
  0 siblings, 1 reply; 6+ messages in thread
From: Johannes Schindelin @ 2008-11-23 11:55 UTC (permalink / raw)
  To: Miklos Vajna; +Cc: git, gitster


The recent addition to the test to show the tag related breakage was
not minimal.

Further, it tested for the string "tag" at the start of the lines,
which matches, "tagger", too.  Test for "tag " instead.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---

	I'll have no problem if this is squashed into Miklos' patch.

 t/t9301-fast-export.sh |    5 +----
 1 files changed, 1 insertions(+), 4 deletions(-)

diff --git a/t/t9301-fast-export.sh b/t/t9301-fast-export.sh
index 078832f..9af50b5 100755
--- a/t/t9301-fast-export.sh
+++ b/t/t9301-fast-export.sh
@@ -234,11 +234,8 @@ test_expect_success 'fast-export -C -C | fast-import' '
 test_expect_failure 'fast-export | fast-import when master is tagged' '
 
 	git tag -m msg last &&
-	rm -rf new &&
-	mkdir new &&
-	git --git-dir=new/.git init &&
 	git fast-export -C -C --signed-tags=strip --all > output &&
-	test $(grep -c "^tag" output) = 3
+	test $(grep -c "^tag " output) = 3
 
 '
 
-- 
1.6.0.2.749.g0cc32

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [BUGFIX PATCH 2/2] fast-export: use an unsorted string list for extra_refs
  2008-11-23 11:55   ` [PATCH 1/2] Simplify and fix t9301 Johannes Schindelin
@ 2008-11-23 11:55     ` Johannes Schindelin
  2008-11-23 18:03       ` Miklos Vajna
  0 siblings, 1 reply; 6+ messages in thread
From: Johannes Schindelin @ 2008-11-23 11:55 UTC (permalink / raw)
  To: Miklos Vajna; +Cc: git, gitster


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

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [BUGFIX PATCH 2/2] fast-export: use an unsorted string list for extra_refs
  2008-11-23 11:55     ` [BUGFIX PATCH 2/2] fast-export: use an unsorted string list for extra_refs Johannes Schindelin
@ 2008-11-23 18:03       ` Miklos Vajna
  2008-11-24  1:07         ` Junio C Hamano
  0 siblings, 1 reply; 6+ messages in thread
From: Miklos Vajna @ 2008-11-23 18:03 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: git, gitster

[-- Attachment #1: Type: text/plain, Size: 542 bytes --]

On Sun, Nov 23, 2008 at 12:55:54PM +0100, Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:
> 
> 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.

Tested-by: Miklos Vajna <vmiklos@frugalware.org>

Thanks!

[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [BUGFIX PATCH 2/2] fast-export: use an unsorted string list for extra_refs
  2008-11-23 18:03       ` Miklos Vajna
@ 2008-11-24  1:07         ` Junio C Hamano
  0 siblings, 0 replies; 6+ messages in thread
From: Junio C Hamano @ 2008-11-24  1:07 UTC (permalink / raw)
  To: Miklos Vajna; +Cc: Johannes Schindelin, git, gitster

Thanks both; I do not have time to actually double-check and apply for the
next 36 hours or so, though.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2008-11-24  1:08 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-11-22  2:29 git fast-export problem with tags Miklos Vajna
2008-11-22 18:22 ` [PATCH] Add new testcase to show fast-export does not always exports all tags Miklos Vajna
2008-11-23 11:55   ` [PATCH 1/2] Simplify and fix t9301 Johannes Schindelin
2008-11-23 11:55     ` [BUGFIX PATCH 2/2] fast-export: use an unsorted string list for extra_refs Johannes Schindelin
2008-11-23 18:03       ` Miklos Vajna
2008-11-24  1:07         ` Junio C Hamano

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).