summaryrefslogtreecommitdiff
path: root/t/t5510-fetch.sh
diff options
context:
space:
mode:
authorMichael Haggerty <mhagger@alum.mit.edu>2013-10-30 05:32:59 (GMT)
committerJunio C Hamano <gitster@pobox.com>2013-10-30 21:16:36 (GMT)
commitc5a84e92a2fe9e8748e32341c344d7a6c0f52a50 (patch)
treedc3431137e2495548a7c03e1e4b52c0c61ec9d17 /t/t5510-fetch.sh
parent0281c930f17042473e973f39810c8f7c93955d7d (diff)
downloadgit-c5a84e92a2fe9e8748e32341c344d7a6c0f52a50.zip
git-c5a84e92a2fe9e8748e32341c344d7a6c0f52a50.tar.gz
git-c5a84e92a2fe9e8748e32341c344d7a6c0f52a50.tar.bz2
fetch --tags: fetch tags *in addition to* other stuff
Previously, fetch's "--tags" option was considered equivalent to specifying the refspec "refs/tags/*:refs/tags/*" on the command line; in particular, it caused the remote.<name>.refspec configuration to be ignored. But it is not very useful to fetch tags without also fetching other references, whereas it *is* quite useful to be able to fetch tags *in addition to* other references. So change the semantics of this option to do the latter. If a user wants to fetch *only* tags, then it is still possible to specifying an explicit refspec: git fetch <remote> 'refs/tags/*:refs/tags/*' Please note that the documentation prior to 1.8.0.3 was ambiguous about this aspect of "fetch --tags" behavior. Commit f0cb2f137c 2012-12-14 fetch --tags: clarify documentation made the documentation match the old behavior. This commit changes the documentation to match the new behavior. Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t5510-fetch.sh')
-rwxr-xr-xt/t5510-fetch.sh22
1 files changed, 19 insertions, 3 deletions
diff --git a/t/t5510-fetch.sh b/t/t5510-fetch.sh
index 8328be1..02e5901 100755
--- a/t/t5510-fetch.sh
+++ b/t/t5510-fetch.sh
@@ -113,7 +113,7 @@ test_expect_success 'fetch --prune with a namespace keeps other namespaces' '
git rev-parse origin/master
'
-test_expect_success 'fetch --prune --tags does not delete the remote-tracking branches' '
+test_expect_success 'fetch --prune --tags prunes tags and branches' '
cd "$D" &&
git clone . prune-tags &&
cd prune-tags &&
@@ -124,7 +124,7 @@ test_expect_success 'fetch --prune --tags does not delete the remote-tracking br
git fetch --prune --tags origin &&
git rev-parse origin/master &&
- git rev-parse origin/fake-remote &&
+ test_must_fail git rev-parse origin/fake-remote &&
test_must_fail git rev-parse sometag
'
@@ -132,10 +132,26 @@ test_expect_success 'fetch --prune --tags with branch does not delete other remo
cd "$D" &&
git clone . prune-tags-branch &&
cd prune-tags-branch &&
+ git tag sometag master &&
git update-ref refs/remotes/origin/extrabranch master &&
git fetch --prune --tags origin master &&
- git rev-parse origin/extrabranch
+ git rev-parse origin/extrabranch &&
+ test_must_fail git rev-parse sometag
+'
+
+test_expect_success 'fetch --prune --tags with refspec prunes based on refspec' '
+ cd "$D" &&
+ git clone . prune-tags-refspec &&
+ cd prune-tags-refspec &&
+ git tag sometag master &&
+ git update-ref refs/remotes/origin/foo/otherbranch master &&
+ git update-ref refs/remotes/origin/extrabranch master &&
+
+ git fetch --prune --tags origin refs/heads/foo/*:refs/remotes/origin/foo/* &&
+ test_must_fail git rev-parse refs/remotes/origin/foo/otherbranch &&
+ git rev-parse origin/extrabranch &&
+ test_must_fail git rev-parse sometag
'
test_expect_success 'fetch tags when there is no tags' '