fetch --tags: fetch tags *in addition to* other stuff
[gitweb.git] / t / t5510-fetch.sh
index 8328be13470ef713273a4f46a6ba58e04c0b1069..02e5901ab1f68ede833c6a98c6d544c5a92c0952 100755 (executable)
@@ -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' '