fetch: treat --tags like refs/tags/*:refs/tags/* when pruning

If --tags is specified, add that refspec to the list given to
prune_refs so it knows to treat it as a filter on what refs to
should consider for prunning. This way

    git fetch --prune --tags origin

only prunes tags and doesn't delete the branch refs.

Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Carlos Martín Nieto
2011-10-15 07:04:26 +02:00
committed by Junio C Hamano
parent ed43de6ec3
commit e8c1e6c796
2 changed files with 23 additions and 4 deletions

View File

@ -105,7 +105,7 @@ test_expect_success 'fetch --prune with a namespace keeps other namespaces' '
git rev-parse origin/master
'
test_expect_failure 'fetch --prune --tags does not delete the remote-tracking branches' '
test_expect_success 'fetch --prune --tags does not delete the remote-tracking branches' '
cd "$D" &&
git clone . prune-tags &&
cd prune-tags &&
@ -116,7 +116,7 @@ test_expect_failure 'fetch --prune --tags does not delete the remote-tracking br
test_must_fail git rev-parse somebranch
'
test_expect_failure 'fetch --prune --tags with branch does not delete other remote-tracking branches' '
test_expect_success 'fetch --prune --tags with branch does not delete other remote-tracking branches' '
cd "$D" &&
git clone . prune-tags-branch &&
cd prune-tags-branch &&