diff options
author | Junio C Hamano <gitster@pobox.com> | 2018-08-20 11:33:52 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2018-08-20 11:33:52 -0700 |
commit | 42a6274b62397ab0047a21729c99f8fb06193f9b (patch) | |
tree | ab4cbf6e8f9cdd4d39bd75df627e8f440ca24a53 | |
parent | Merge branch 'ng/mergetool-lose-final-prompt' (diff) | |
parent | pull doc: fix a long-standing grammar error (diff) | |
download | tgif-42a6274b62397ab0047a21729c99f8fb06193f9b.tar.xz |
Merge branch 'ab/fetch-tags-noclobber'
Test and doc clean-ups.
* ab/fetch-tags-noclobber:
pull doc: fix a long-standing grammar error
fetch tests: correct a comment "remove it" -> "remove them"
push tests: assert re-pushing annotated tags
push tests: add more testing for forced tag pushing
push tests: fix logic error in "push" test assertion
push tests: remove redundant 'git push' invocation
fetch tests: change "Tag" test tag to "testTag"
-rw-r--r-- | Documentation/pull-fetch-param.txt | 2 | ||||
-rwxr-xr-x | t/t5510-fetch.sh | 2 | ||||
-rwxr-xr-x | t/t5516-fetch-push.sh | 65 |
3 files changed, 47 insertions, 22 deletions
diff --git a/Documentation/pull-fetch-param.txt b/Documentation/pull-fetch-param.txt index c579793af5..f1fb08dc68 100644 --- a/Documentation/pull-fetch-param.txt +++ b/Documentation/pull-fetch-param.txt @@ -33,7 +33,7 @@ name. it requests fetching everything up to the given tag. + The remote ref that matches <src> -is fetched, and if <dst> is not empty string, the local +is fetched, and if <dst> is not an empty string, the local ref that matches it is fast-forwarded using <src>. If the optional plus `+` is used, the local ref is updated even if it does not result in a fast-forward diff --git a/t/t5510-fetch.sh b/t/t5510-fetch.sh index 5e810f494e..3b7b30568c 100755 --- a/t/t5510-fetch.sh +++ b/t/t5510-fetch.sh @@ -648,7 +648,7 @@ test_configured_prune_type () { git rev-parse --verify refs/tags/newtag ) && - # now remove it + # now remove them git branch -d newbranch && git tag -d newtag && diff --git a/t/t5516-fetch-push.sh b/t/t5516-fetch-push.sh index bd8f23e430..539c25aada 100755 --- a/t/t5516-fetch-push.sh +++ b/t/t5516-fetch-push.sh @@ -965,26 +965,51 @@ test_expect_success 'push into aliased refs (inconsistent)' ' ) ' -test_expect_success 'push requires --force to update lightweight tag' ' - mk_test testrepo heads/master && - mk_child testrepo child1 && - mk_child testrepo child2 && - ( - cd child1 && - git tag Tag && - git push ../child2 Tag && - git push ../child2 Tag && - >file1 && - git add file1 && - git commit -m "file1" && - git tag -f Tag && - test_must_fail git push ../child2 Tag && - git push --force ../child2 Tag && - git tag -f Tag && - test_must_fail git push ../child2 Tag HEAD~ && - git push --force ../child2 Tag - ) -' +test_force_push_tag () { + tag_type_description=$1 + tag_args=$2 + + test_expect_success 'force pushing required to update lightweight tag' " + mk_test testrepo heads/master && + mk_child testrepo child1 && + mk_child testrepo child2 && + ( + cd child1 && + git tag testTag && + git push ../child2 testTag && + >file1 && + git add file1 && + git commit -m 'file1' && + git tag $tag_args testTag && + test_must_fail git push ../child2 testTag && + git push --force ../child2 testTag && + git tag $tag_args testTag HEAD~ && + test_must_fail git push ../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 + ) + " +} + +test_force_push_tag "lightweight tag" "-f" +test_force_push_tag "annotated tag" "-f -a -m'msg'" test_expect_success 'push --porcelain' ' mk_empty testrepo && |