From 54e934e66ddc9d61b3a8b2a6956bd434e6fccfcd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=86var=20Arnfj=C3=B6r=C3=B0=20Bjarmason?= Date: Tue, 31 Jul 2018 13:07:09 +0000 Subject: fetch tests: change "Tag" test tag to "testTag" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Calling the test tag "Tag" will make for confusing reading later in this series when making use of the "git push tag " feature. Let's call the tag testTag instead. Changes code initially added in dbfeddb12e ("push: require force for refs under refs/tags/", 2012-11-29). Signed-off-by: Ævar Arnfjörð Bjarmason Signed-off-by: Junio C Hamano diff --git a/t/t5516-fetch-push.sh b/t/t5516-fetch-push.sh index a5077d8..08b9cf5 100755 --- a/t/t5516-fetch-push.sh +++ b/t/t5516-fetch-push.sh @@ -971,18 +971,18 @@ test_expect_success 'push requires --force to update lightweight tag' ' mk_child testrepo child2 && ( cd child1 && - git tag Tag && - git push ../child2 Tag && - git push ../child2 Tag && + git tag testTag && + git push ../child2 testTag && + git push ../child2 testTag && >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 + git tag -f testTag && + test_must_fail git push ../child2 testTag && + git push --force ../child2 testTag && + git tag -f testTag && + test_must_fail git push ../child2 testTag HEAD~ && + git push --force ../child2 testTag ) ' -- cgit v0.10.2-6-g49f6 From 76bcde5956c9094189a2a18b82574ed940e804dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=86var=20Arnfj=C3=B6r=C3=B0=20Bjarmason?= Date: Tue, 31 Jul 2018 13:07:10 +0000 Subject: push tests: remove redundant 'git push' invocation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Remove an invocation of 'git push' that's exactly the same as the one on the preceding line. This was seemingly added by mistake in dbfeddb12e ("push: require force for refs under refs/tags/", 2012-11-29) and doesn't affect the result of the test, the second "push" was a no-op as there was nothing new to push. Signed-off-by: Ævar Arnfjörð Bjarmason Signed-off-by: Junio C Hamano diff --git a/t/t5516-fetch-push.sh b/t/t5516-fetch-push.sh index 08b9cf5..4d487d6 100755 --- a/t/t5516-fetch-push.sh +++ b/t/t5516-fetch-push.sh @@ -973,7 +973,6 @@ test_expect_success 'push requires --force to update lightweight tag' ' cd child1 && git tag testTag && git push ../child2 testTag && - git push ../child2 testTag && >file1 && git add file1 && git commit -m "file1" && -- cgit v0.10.2-6-g49f6 From 25f74f5234ffe2f0100b06c657fedb9cc7774ed3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=86var=20Arnfj=C3=B6r=C3=B0=20Bjarmason?= Date: Tue, 31 Jul 2018 13:07:11 +0000 Subject: push tests: fix logic error in "push" test assertion MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix a logic error that's been here since this test was added in dbfeddb12e ("push: require force for refs under refs/tags/", 2012-11-29). The intent of this test is to force-create a new tag pointing to HEAD~, and then assert that pushing it doesn't work without --force. Instead, the code was not creating a new tag at all, and then failing to push the previous tag for the unrelated reason of providing a refspec that doesn't make any sense. Signed-off-by: Ævar Arnfjörð Bjarmason Signed-off-by: Junio C Hamano diff --git a/t/t5516-fetch-push.sh b/t/t5516-fetch-push.sh index 4d487d6..82af990 100755 --- a/t/t5516-fetch-push.sh +++ b/t/t5516-fetch-push.sh @@ -979,8 +979,8 @@ test_expect_success 'push requires --force to update lightweight tag' ' git tag -f testTag && test_must_fail git push ../child2 testTag && git push --force ../child2 testTag && - git tag -f testTag && - test_must_fail git push ../child2 testTag HEAD~ && + git tag -f testTag HEAD~ && + test_must_fail git push ../child2 testTag && git push --force ../child2 testTag ) ' -- cgit v0.10.2-6-g49f6 From 941a7baa4d7aa592b9373180dcc13aaf2681f7a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=86var=20Arnfj=C3=B6r=C3=B0=20Bjarmason?= Date: Tue, 31 Jul 2018 13:07:12 +0000 Subject: push tests: add more testing for forced tag pushing MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Signed-off-by: Junio C Hamano 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 " format + git tag -f testTag HEAD~ && + test_must_fail git push ../child2 tag testTag && + git push --force ../child2 tag testTag ) ' -- cgit v0.10.2-6-g49f6 From 380efb65df09666a1999c0e36513a3076481b83a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=86var=20Arnfj=C3=B6r=C3=B0=20Bjarmason?= Date: Tue, 31 Jul 2018 13:07:13 +0000 Subject: push tests: assert re-pushing annotated tags MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change the test that asserts that lightweight tags can only be clobbered by a force-push to check do the same tests for annotated tags. There used to be less exhaustive tests for this with the code added in 40eff17999 ("push: require force for annotated tags", 2012-11-29), but Junio removed them in 256b9d70a4 ("push: fix "refs/tags/ hierarchy cannot be updated without --force"", 2013-01-16) while fixing some of the behavior around tag pushing. That change left us without any coverage asserting that pushing and clobbering annotated tags worked as intended. There was no reason to suspect that the receive machinery wouldn't behave the same way with annotated tags, but now we know for sure. Signed-off-by: Ævar Arnfjörð Bjarmason Signed-off-by: Junio C Hamano diff --git a/t/t5516-fetch-push.sh b/t/t5516-fetch-push.sh index 4bd533d..1331a8d 100755 --- a/t/t5516-fetch-push.sh +++ b/t/t5516-fetch-push.sh @@ -965,43 +965,51 @@ test_expect_success 'push into aliased refs (inconsistent)' ' ) ' -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 -f testTag && - test_must_fail git push ../child2 testTag && - git push --force ../child2 testTag && - git tag -f 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 " format - git tag -f testTag HEAD~ && - test_must_fail git push ../child2 tag testTag && - git push --force ../child2 tag testTag - ) -' +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 ' 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 && -- cgit v0.10.2-6-g49f6 From d365112115ef77225d6361422429501fc06593af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=86var=20Arnfj=C3=B6r=C3=B0=20Bjarmason?= Date: Mon, 13 Aug 2018 19:22:48 +0000 Subject: fetch tests: correct a comment "remove it" -> "remove them" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Correct a comment referring to the removal of just the branch to also refer to the tag. This should have been changed in my ca3065e7e7 ("fetch tests: add a tag to be deleted to the pruning tests", 2018-02-09) when the tag deletion was added, but I missed it at the time. Signed-off-by: Ævar Arnfjörð Bjarmason Signed-off-by: Junio C Hamano diff --git a/t/t5510-fetch.sh b/t/t5510-fetch.sh index e402aee..6ab0932 100755 --- a/t/t5510-fetch.sh +++ b/t/t5510-fetch.sh @@ -613,7 +613,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 && -- cgit v0.10.2-6-g49f6 From b81699af4861f9363cdebb86e8f3d95bd0b794dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=86var=20Arnfj=C3=B6r=C3=B0=20Bjarmason?= Date: Mon, 13 Aug 2018 19:22:49 +0000 Subject: pull doc: fix a long-standing grammar error MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It should be "is not an empty string" not "is not empty string". This fixes wording originally introduced in ab9b31386b ("Documentation: multi-head fetch.", 2005-08-24). Signed-off-by: Ævar Arnfjörð Bjarmason Signed-off-by: Junio C Hamano diff --git a/Documentation/pull-fetch-param.txt b/Documentation/pull-fetch-param.txt index c579793..f1fb08d 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 -is fetched, and if is not empty string, the local +is fetched, and if is not an empty string, the local ref that matches it is fast-forwarded using . If the optional plus `+` is used, the local ref is updated even if it does not result in a fast-forward -- cgit v0.10.2-6-g49f6