summaryrefslogtreecommitdiff
path: root/t/t5516-fetch-push.sh
diff options
context:
space:
mode:
authorÆvar Arnfjörð Bjarmason <avarab@gmail.com>2018-07-31 13:07:12 (GMT)
committerJunio C Hamano <gitster@pobox.com>2018-07-31 16:25:25 (GMT)
commit941a7baa4d7aa592b9373180dcc13aaf2681f7a1 (patch)
tree21571118638be9990d7166d493473e049676c1b5 /t/t5516-fetch-push.sh
parent25f74f5234ffe2f0100b06c657fedb9cc7774ed3 (diff)
downloadgit-941a7baa4d7aa592b9373180dcc13aaf2681f7a1.zip
git-941a7baa4d7aa592b9373180dcc13aaf2681f7a1.tar.gz
git-941a7baa4d7aa592b9373180dcc13aaf2681f7a1.tar.bz2
push tests: add more testing for forced tag pushing
Improve the tests added in dbfeddb12e ("push: require force for refs under refs/tags/", 2012-11-29) to assert that the same behavior applies various other combinations of command-line option and refspecs. Supplying either "+" in refspec or "--force" is sufficient to clobber the reference. With --no-force we still pay attention to "+" in the refspec, and vice-versa with clobbering kicking in if there's no "+" in the refspec but "+" is given. This is consistent with how refspecs work for branches, where either "+" or "--force" will enable clobbering, with neither taking priority over the other. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t5516-fetch-push.sh')
-rwxr-xr-xt/t5516-fetch-push.sh22
1 files changed, 20 insertions, 2 deletions
diff --git a/t/t5516-fetch-push.sh b/t/t5516-fetch-push.sh
index 82af990..4bd533d 100755
--- a/t/t5516-fetch-push.sh
+++ b/t/t5516-fetch-push.sh
@@ -965,7 +965,7 @@ test_expect_success 'push into aliased refs (inconsistent)' '
)
'
-test_expect_success 'push requires --force to update lightweight tag' '
+test_expect_success 'force pushing required to update lightweight tag' '
mk_test testrepo heads/master &&
mk_child testrepo child1 &&
mk_child testrepo child2 &&
@@ -981,7 +981,25 @@ test_expect_success 'push requires --force to update lightweight tag' '
git push --force ../child2 testTag &&
git tag -f testTag HEAD~ &&
test_must_fail git push ../child2 testTag &&
- git push --force ../child2 testTag
+ git push --force ../child2 testTag &&
+
+ # Clobbering without + in refspec needs --force
+ git tag -f testTag &&
+ test_must_fail git push ../child2 "refs/tags/*:refs/tags/*" &&
+ git push --force ../child2 "refs/tags/*:refs/tags/*" &&
+
+ # Clobbering with + in refspec does not need --force
+ git tag -f testTag HEAD~ &&
+ git push ../child2 "+refs/tags/*:refs/tags/*" &&
+
+ # Clobbering with --no-force still obeys + in refspec
+ git tag -f testTag &&
+ git push --no-force ../child2 "+refs/tags/*:refs/tags/*" &&
+
+ # Clobbering with/without --force and "tag <name>" format
+ git tag -f testTag HEAD~ &&
+ test_must_fail git push ../child2 tag testTag &&
+ git push --force ../child2 tag testTag
)
'