@matheusbsbs / matheus-bagliano / commits / 468386a956
Fork 0

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> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Johannes Schindelin committed Aug 8, 2008 at 04:29 UTC 468386a956c09ff59dd2b8fd681e162b2e167392
2 files changed +14 -1
builtin-clone.c
+2 -1
@@ -330,7 +330,8 @@ static struct ref *write_remote_refs(const struct ref *refs,
330 struct ref *r;
331
332 get_fetch_map(refs, refspec, &tail, 0);
333 - get_fetch_map(refs, tag_refspec, &tail, 0);
333 + if (!option_mirror)
334 + get_fetch_map(refs, tag_refspec, &tail, 0);
335
336 for (r = local_refs; r; r = r->next)
337 add_extra_ref(r->peer_ref->name, r->old_sha1, 0);
t/t5601-clone.sh
+12
@@ -95,4 +95,16 @@ test_expect_success 'clone --bare names the local repository <name>.git' '
95
96 '
97
98 +test_expect_success 'clone --mirror does not repeat tags' '
99 +
100 + (cd src &&
101 + git tag some-tag HEAD) &&
102 + git clone --mirror src mirror2 &&
103 + (cd mirror2 &&
104 + git show-ref 2> clone.err > clone.out) &&
105 + test_must_fail grep Duplicate mirror2/clone.err &&
106 + grep some-tag mirror2/clone.out
107 +
108 +'
109 +
110 test_done