]> git.ipfire.org Git - thirdparty/git.git/commitdiff
t5510: check that "git fetch --prune --tags" does not prune branches
authorMichael Haggerty <mhagger@alum.mit.edu>
Wed, 23 Oct 2013 15:50:36 +0000 (17:50 +0200)
committerJunio C Hamano <gitster@pobox.com>
Thu, 24 Oct 2013 20:27:46 +0000 (13:27 -0700)
"git fetch --prune --tags" is currently interpreted as follows:

* "--tags" is equivalent to specifying a refspec
  "refs/tags/*:refs/tags/*", and supersedes any default refspecs
  configured via remote.$REMOTE.fetch.

* "--prune" only operates on the refspecs being fetched.

Therefore, "git fetch --prune --tags" prunes tags in refs/tags/* but
does not fetch or prune other references.  The fact that this command
does not prune references outside of refs/tags/* was previously
untested.  So add a test that verifies the status quo.

However, the status quo is surprising, so it will be changed later in
this patch series.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/t5510-fetch.sh

index 08d8dbb9172ed82b9f351bf68d529791ddecba12..8328be13470ef713273a4f46a6ba58e04c0b1069 100755 (executable)
@@ -118,9 +118,13 @@ test_expect_success 'fetch --prune --tags does not delete the remote-tracking br
        git clone . prune-tags &&
        cd prune-tags &&
        git tag sometag master &&
+       # Create what looks like a remote-tracking branch from an earlier
+       # fetch that has since been deleted from the remote:
+       git update-ref refs/remotes/origin/fake-remote master &&
 
        git fetch --prune --tags origin &&
        git rev-parse origin/master &&
+       git rev-parse origin/fake-remote &&
        test_must_fail git rev-parse sometag
 '