threads / discuss / 14881

1.6.0.rc2: Duplicated refs when using git clone --mirror

Subject: 1.6.0.rc2: Duplicated refs when using git clone --mirror

## tl;dr

4 messages between Aug 8, 2008 and Aug 8, 2008.

replies: 3people: 3as markdown or json

Cesar Eduardo Barros· Aug 8, 2008, 00:59 UTC · lore

cesarb@delta:/tmp$ PATH=~/opt/git/bin:$PATH git --version git version 1.6.0.rc2 cesarb@delta:/tmp$ PATH=~/opt/git/bin:$PATH git clone --mirror git://git.kernel.org/pub/scm/git/git.git Initialized empty Git repository in /tmp/git.git/ remote: Counting objects: 80828, done. remote: Compressing objects: 100% (21488/21488), done. remote: Total 80828 (delta 58880), reused 79522 (delta 57902) Receiving objects: 100% (80828/80828), 16.84 MiB | 97 KiB/s, done. Resolving deltas: 100% (58880/58880), done. cesarb@delta:/tmp$ cd git.git/ cesarb@delta:/tmp/git.git$ PATH=~/opt/git/bin:$PATH git fetch warning: Duplicated ref: refs/tags/gitgui-0.10.0 warning: Duplicated ref: refs/tags/gitgui-0.10.1 warning: Duplicated ref: refs/tags/gitgui-0.10.2 warning: Duplicated ref: refs/tags/gitgui-0.6.0 warning: Duplicated ref: refs/tags/gitgui-0.6.1 warning: Duplicated ref: refs/tags/gitgui-0.6.2 warning: Duplicated ref: refs/tags/gitgui-0.6.3 warning: Duplicated ref: refs/tags/gitgui-0.6.4 warning: Duplicated ref: refs/tags/gitgui-0.6.5 warning: Duplicated ref: refs/tags/gitgui-0.7.0 warning: Duplicated ref: refs/tags/gitgui-0.7.0-rc1 warning: Duplicated ref: refs/tags/gitgui-0.7.1 warning: Duplicated ref: refs/tags/gitgui-0.7.2 warning: Duplicated ref: refs/tags/gitgui-0.7.3 warning: Duplicated ref: refs/tags/gitgui-0.7.4 warning: Duplicated ref: refs/tags/gitgui-0.7.5 warning: Duplicated ref: refs/tags/gitgui-0.8.0 warning: Duplicated ref: refs/tags/gitgui-0.8.1 warning: Duplicated ref: refs/tags/gitgui-0.8.2 warning: Duplicated ref: refs/tags/gitgui-0.8.3 warning: Duplicated ref: refs/tags/gitgui-0.8.4 warning: Duplicated ref: refs/tags/gitgui-0.9.0 warning: Duplicated ref: refs/tags/gitgui-0.9.1 warning: Duplicated ref: refs/tags/gitgui-0.9.2 warning: Duplicated ref: refs/tags/gitgui-0.9.3 warning: Duplicated ref: refs/tags/junio-gpg-pub warning: Duplicated ref: refs/tags/v0.99 warning: Duplicated ref: refs/tags/v0.99.9h warning: Duplicated ref: refs/tags/v0.99.9i warning: Duplicated ref: refs/tags/v0.99.9j warning: Duplicated ref: refs/tags/v0.99.9k warning: Duplicated ref: refs/tags/v0.99.9l warning: Duplicated ref: refs/tags/v0.99.9m warning: Duplicated ref: refs/tags/v0.99.9n warning: Duplicated ref: refs/tags/v1.0.0 warning: Duplicated ref: refs/tags/v1.0.0a warning: Duplicated ref: refs/tags/v1.0.0b warning: Duplicated ref: refs/tags/v1.0.10 warning: Duplicated ref: refs/tags/v1.0.11 warning: Duplicated ref: refs/tags/v1.0.12 warning: Duplicated ref: refs/tags/v1.0.13 warning: Duplicated ref: refs/tags/v1.0.3 warning: Duplicated ref: refs/tags/v1.0.4 warning: Duplicated ref: refs/tags/v1.0.5 warning: Duplicated ref: refs/tags/v1.0.6 warning: Duplicated ref: refs/tags/v1.0.7 warning: Duplicated ref: refs/tags/v1.0.8 warning: Duplicated ref: refs/tags/v1.0.9 warning: Duplicated ref: refs/tags/v1.0rc1 warning: Duplicated ref: refs/tags/v1.0rc2 warning: Duplicated ref: refs/tags/v1.0rc3 warning: Duplicated ref: refs/tags/v1.0rc4 warning: Duplicated ref: refs/tags/v1.0rc5 warning: Duplicated ref: refs/tags/v1.0rc6 warning: Duplicated ref: refs/tags/v1.1.0 warning: Duplicated ref: refs/tags/v1.1.1 warning: Duplicated ref: refs/tags/v1.1.2 warning: Duplicated ref: refs/tags/v1.1.3 warning: Duplicated ref: refs/tags/v1.1.4 warning: Duplicated ref: refs/tags/v1.1.5 warning: Duplicated ref: refs/tags/v1.1.6 warning: Duplicated ref: refs/tags/v1.2.0 warning: Duplicated ref: refs/tags/v1.2.1 warning: Duplicated ref: refs/tags/v1.2.2 warning: Duplicated ref: refs/tags/v1.2.3 warning: Duplicated ref: refs/tags/v1.2.4 warning: Duplicated ref: refs/tags/v1.2.5 warning: Duplicated ref: refs/tags/v1.2.6 warning: Duplicated ref: refs/tags/v1.3.0 warning: Duplicated ref: refs/tags/v1.3.0-rc1 warning: Duplicated ref: refs/tags/v1.3.0-rc2 warning: Duplicated ref: refs/tags/v1.3.0-rc3 warning: Duplicated ref: refs/tags/v1.3.0-rc4 warning: Duplicated ref: refs/tags/v1.3.1 warning: Duplicated ref: refs/tags/v1.3.2 warning: Duplicated ref: refs/tags/v1.3.3 warning: Duplicated ref: refs/tags/v1.4.0 warning: Duplicated ref: refs/tags/v1.4.0-rc1 warning: Duplicated ref: refs/tags/v1.4.0-rc2 warning: Duplicated ref: refs/tags/v1.4.1 warning: Duplicated ref: refs/tags/v1.4.1-rc1 warning: Duplicated ref: refs/tags/v1.4.1-rc2 warning: Duplicated ref: refs/tags/v1.4.1.1 warning: Duplicated ref: refs/tags/v1.4.2 warning: Duplicated ref: refs/tags/v1.4.2-rc1 warning: Duplicated ref: refs/tags/v1.4.2-rc2 warning: Duplicated ref: refs/tags/v1.4.2-rc3 warning: Duplicated ref: refs/tags/v1.4.2-rc4 warning: Duplicated ref: refs/tags/v1.4.2.1 warning: Duplicated ref: refs/tags/v1.4.2.2 warning: Duplicated ref: refs/tags/v1.4.2.3 warning: Duplicated ref: refs/tags/v1.4.2.4 warning: Duplicated ref: refs/tags/v1.4.3 warning: Duplicated ref: refs/tags/v1.4.3-rc1 warning: Duplicated ref: refs/tags/v1.4.3-rc2 warning: Duplicated ref: refs/tags/v1.4.3-rc3 warning: Duplicated ref: refs/tags/v1.4.3.1 warning: Duplicated ref: refs/tags/v1.4.3.2 warning: Duplicated ref: refs/tags/v1.4.3.3 warning: Duplicated ref: refs/tags/v1.4.3.4 warning: Duplicated ref: refs/tags/v1.4.3.5 warning: Duplicated ref: refs/tags/v1.4.4 warning: Duplicated ref: refs/tags/v1.4.4-rc1 warning: Duplicated ref: refs/tags/v1.4.4-rc2 warning: Duplicated ref: refs/tags/v1.4.4.1 warning: Duplicated ref: refs/tags/v1.4.4.2 warning: Duplicated ref: refs/tags/v1.4.4.3 warning: Duplicated ref: refs/tags/v1.4.4.4 warning: Duplicated ref: refs/tags/v1.4.4.5 warning: Duplicated ref: refs/tags/v1.5.0 warning: Duplicated ref: refs/tags/v1.5.0-rc0 warning: Duplicated ref: refs/tags/v1.5.0-rc1 warning: Duplicated ref: refs/tags/v1.5.0-rc2 warning: Duplicated ref: refs/tags/v1.5.0-rc3 warning: Duplicated ref: refs/tags/v1.5.0-rc4 warning: Duplicated ref: refs/tags/v1.5.0.1 warning: Duplicated ref: refs/tags/v1.5.0.2 warning: Duplicated ref: refs/tags/v1.5.0.3 warning: Duplicated ref: refs/tags/v1.5.0.4 warning: Duplicated ref: refs/tags/v1.5.0.5 warning: Duplicated ref: refs/tags/v1.5.0.6 warning: Duplicated ref: refs/tags/v1.5.0.7 warning: Duplicated ref: refs/tags/v1.5.1 warning: Duplicated ref: refs/tags/v1.5.1-rc1 warning: Duplicated ref: refs/tags/v1.5.1-rc2 warning: Duplicated ref: refs/tags/v1.5.1-rc3 warning: Duplicated ref: refs/tags/v1.5.1.1 warning: Duplicated ref: refs/tags/v1.5.1.2 warning: Duplicated ref: refs/tags/v1.5.1.3 warning: Duplicated ref: refs/tags/v1.5.1.4 warning: Duplicated ref: refs/tags/v1.5.1.5 warning: Duplicated ref: refs/tags/v1.5.1.6 warning: Duplicated ref: refs/tags/v1.5.2 warning: Duplicated ref: refs/tags/v1.5.2-rc0 warning: Duplicated ref: refs/tags/v1.5.2-rc1 warning: Duplicated ref: refs/tags/v1.5.2-rc2 warning: Duplicated ref: refs/tags/v1.5.2-rc3 warning: Duplicated ref: refs/tags/v1.5.2.1 warning: Duplicated ref: refs/tags/v1.5.2.2 warning: Duplicated ref: refs/tags/v1.5.2.3 warning: Duplicated ref: refs/tags/v1.5.2.4 warning: Duplicated ref: refs/tags/v1.5.2.5 warning: Duplicated ref: refs/tags/v1.5.3 warning: Duplicated ref: refs/tags/v1.5.3-rc0 warning: Duplicated ref: refs/tags/v1.5.3-rc1 warning: Duplicated ref: refs/tags/v1.5.3-rc2 warning: Duplicated ref: refs/tags/v1.5.3-rc3 warning: Duplicated ref: refs/tags/v1.5.3-rc4 warning: Duplicated ref: refs/tags/v1.5.3-rc5 warning: Duplicated ref: refs/tags/v1.5.3-rc6 warning: Duplicated ref: refs/tags/v1.5.3-rc7 warning: Duplicated ref: refs/tags/v1.5.3.1 warning: Duplicated ref: refs/tags/v1.5.3.2 warning: Duplicated ref: refs/tags/v1.5.3.3 warning: Duplicated ref: refs/tags/v1.5.3.4 warning: Duplicated ref: refs/tags/v1.5.3.5 warning: Duplicated ref: refs/tags/v1.5.3.6 warning: Duplicated ref: refs/tags/v1.5.3.7 warning: Duplicated ref: refs/tags/v1.5.3.8 warning: Duplicated ref: refs/tags/v1.5.4 warning: Duplicated ref: refs/tags/v1.5.4-rc0 warning: Duplicated ref: refs/tags/v1.5.4-rc1 warning: Duplicated ref: refs/tags/v1.5.4-rc2 warning: Duplicated ref: refs/tags/v1.5.4-rc3 warning: Duplicated ref: refs/tags/v1.5.4-rc4 warning: Duplicated ref: refs/tags/v1.5.4-rc5 warning: Duplicated ref: refs/tags/v1.5.4.1 warning: Duplicated ref: refs/tags/v1.5.4.2 warning: Duplicated ref: refs/tags/v1.5.4.3 warning: Duplicated ref: refs/tags/v1.5.4.4 warning: Duplicated ref: refs/tags/v1.5.4.5 warning: Duplicated ref: refs/tags/v1.5.4.6 warning: Duplicated ref: refs/tags/v1.5.5 warning: Duplicated ref: refs/tags/v1.5.5-rc0 warning: Duplicated ref: refs/tags/v1.5.5-rc1 warning: Duplicated ref: refs/tags/v1.5.5-rc2 warning: Duplicated ref: refs/tags/v1.5.5-rc3 warning: Duplicated ref: refs/tags/v1.5.5.1 warning: Duplicated ref: refs/tags/v1.5.5.2 warning: Duplicated ref: refs/tags/v1.5.5.3 warning: Duplicated ref: refs/tags/v1.5.5.4 warning: Duplicated ref: refs/tags/v1.5.5.5 warning: Duplicated ref: refs/tags/v1.5.6 warning: Duplicated ref: refs/tags/v1.5.6-rc0 warning: Duplicated ref: refs/tags/v1.5.6-rc1 warning: Duplicated ref: refs/tags/v1.5.6-rc2 warning: Duplicated ref: refs/tags/v1.5.6-rc3 warning: Duplicated ref: refs/tags/v1.5.6.1 warning: Duplicated ref: refs/tags/v1.5.6.2 warning: Duplicated ref: refs/tags/v1.5.6.3 warning: Duplicated ref: refs/tags/v1.5.6.4 warning: Duplicated ref: refs/tags/v1.5.6.5 warning: Duplicated ref: refs/tags/v1.6.0-rc0 warning: Duplicated ref: refs/tags/v1.6.0-rc1 warning: Duplicated ref: refs/tags/v1.6.0-rc2 warning: Duplicated ref: refs/tags/v0.99.9g cesarb@delta:/tmp/git.git$

There is no file in refs/; the contents of packed-refs are like:

# pack-refs with: peeled b7d75e49508ac928677f5cb83f490cf40a7c83d3 refs/tags/v1.6.0-rc2 ^1fdf6ee6f81b31b299a8039832f45290faa4583a ad6137f51f5f67e2558849629332c7443ed01108 refs/tags/v1.6.0-rc1 ^8e1db3871c767cb17b5e0eeb7bea8d967821a055 4be80e6b423b9ceffab50e120855806712ab3255 refs/tags/v1.6.0-rc0 ^93310a40eb022a0e36e7c618921931d8ffc31fd1 07cca3b30ee2b5d060e44e5b18d7c22929c63d1a refs/tags/v1.5.6.5 ^781c1834f5419bdf81bb7f3750170ccd6b809174 [...] 33682a5e98adfd8ba4ce0e21363c443bd273eb77 refs/tags/gitgui-0.10.1 ^729ffa50f75a025935623bfc58d0932c65f7de2f d5aef6e4d58cfe1549adef5b436f3ace984e8c86 refs/tags/gitgui-0.10.0 ^3d654be48f65545c4d3e35f5d3bbed5489820930 b7d75e49508ac928677f5cb83f490cf40a7c83d3 refs/tags/v1.6.0-rc2 ^1fdf6ee6f81b31b299a8039832f45290faa4583a ad6137f51f5f67e2558849629332c7443ed01108 refs/tags/v1.6.0-rc1 ^8e1db3871c767cb17b5e0eeb7bea8d967821a055 4be80e6b423b9ceffab50e120855806712ab3255 refs/tags/v1.6.0-rc0 ^93310a40eb022a0e36e7c618921931d8ffc31fd1 07cca3b30ee2b5d060e44e5b18d7c22929c63d1a refs/tags/v1.5.6.5 ^781c1834f5419bdf81bb7f3750170ccd6b809174 [...] 33682a5e98adfd8ba4ce0e21363c443bd273eb77 refs/tags/gitgui-0.10.1 ^729ffa50f75a025935623bfc58d0932c65f7de2f d5aef6e4d58cfe1549adef5b436f3ace984e8c86 refs/tags/gitgui-0.10.0 ^3d654be48f65545c4d3e35f5d3bbed5489820930 19a1e065c865db403a41af97b2e9e81f1d01dd9e refs/heads/todo 0e60d74cc02f6a0af58a1f99e54509dafc7c8f6a refs/heads/pu 9c632062aee88de890e8b30d8763f83abe1da113 refs/heads/next 1fdf6ee6f81b31b299a8039832f45290faa4583a refs/heads/master 99ad2efc3f7764a1c21e464412af95a8ffe3b5d6 refs/heads/man 781c1834f5419bdf81bb7f3750170ccd6b809174 refs/heads/maint b53db3ca58a8a65d8de3b9fa048d410757edc38f refs/heads/html

-- 
Cesar Eduardo Barros
cesarb@cesarb.net
cesar.barros@gmail.com
Johannes Schindelin· Aug 8, 2008, 02:29 UTC · re: Cesar Eduardo Barros · lore

[PATCH] clone --mirror: avoid storing repeated tags

With --mirror, clone asks for refs/* already, so it does not need to ask for ref/tags/*, too.

Noticed by Cesar Eduardo Barros.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 builtin-clone.c  |    3 ++-
 t/t5601-clone.sh |   12 ++++++++++++
 2 files changed, 14 insertions(+), 1 deletions(-)
diff --git a/builtin-clone.c b/builtin-clone.c
index 8612d59..c0e3086 100644
--- a/builtin-clone.c
+++ b/builtin-clone.c
@@ -330,7 +330,8 @@ static struct ref *write_remote_refs(const struct ref *refs,
 	struct ref *r;
 
 	get_fetch_map(refs, refspec, &tail, 0);
-	get_fetch_map(refs, tag_refspec, &tail, 0);
+	if (!option_mirror)
+		get_fetch_map(refs, tag_refspec, &tail, 0);
 
 	for (r = local_refs; r; r = r->next)
 		add_extra_ref(r->peer_ref->name, r->old_sha1, 0);
diff --git a/t/t5601-clone.sh b/t/t5601-clone.sh
index a13b6f9..59c65fe 100755
--- a/t/t5601-clone.sh
+++ b/t/t5601-clone.sh
@@ -95,4 +95,16 @@ test_expect_success 'clone --bare names the local repository <name>.git' '
 
 '
 
+test_expect_success 'clone --mirror does not repeat tags' '
+
+	(cd src &&
+	 git tag some-tag HEAD) &&
+	git clone --mirror src mirror2 &&
+	(cd mirror2 &&
+	 git show-ref 2> clone.err > clone.out) &&
+	test_must_fail grep Duplicate mirror2/clone.err &&
+	grep some-tag mirror2/clone.out
+
+'
+
 test_done
-- 
1.6.0.rc1.112.gebbe4
Junio C Hamano· Aug 8, 2008, 04:57 UTC · re: Johannes Schindelin · lore

Re: [PATCH] clone --mirror: avoid storing repeated tags

Thanks for reporting and a quick fix.

This made me wonder if this relatively new "pack cloned refs" codepath has funny interaction with --reference which is another user of add_extra_refs(), but I think it is safe (we clear the real "extra" ones used during the object transfer before calling write_remote_refs()).

Junio C Hamano· Aug 8, 2008, 06:41 UTC · re: Junio C Hamano · lore

Re: [PATCH] clone --mirror: avoid storing repeated tags

Junio C Hamano <gitster@pobox.com> writes:
> Thanks for reporting and a quick fix.

By the way, Dscho, do you have comments on recent filter-branch thread and patches?

← back to recent threads