Skip to content

Commit

Permalink
clone --mirror: avoid storing repeated tags
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Johannes Schindelin authored and Junio C Hamano committed Aug 8, 2008
1 parent 1fdf6ee commit 468386a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
3 changes: 2 additions & 1 deletion builtin-clone.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
12 changes: 12 additions & 0 deletions t/t5601-clone.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 468386a

Please sign in to comment.