fetch tests: add a test for clobbering tag behavior

The test suite only incidentally (and unintentionally) tested for the current behavior of eager tag clobbering on "fetch". This is a followup to 380efb65df ("push tests: assert re-pushing annotated tags", 2018-07-31) which tests for it explicitly. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Ævar Arnfjörð Bjarmason committed Aug 31, 2018 at 20:09 UTC 6b0b0677f6d92932bacd73981a47724b543dfd90
1 file changed +24
t/t5516-fetch-push.sh
+24
@@ -1011,6 +1011,30 @@ test_force_push_tag () {
1011 test_force_push_tag "lightweight tag" "-f"
1012 test_force_push_tag "annotated tag" "-f -a -m'tag message'"
1013
1014 +test_force_fetch_tag () {
1015 + tag_type_description=$1
1016 + tag_args=$2
1017 +
1018 + test_expect_success "fetch will clobber an existing $tag_type_description" "
1019 + mk_test testrepo heads/master &&
1020 + mk_child testrepo child1 &&
1021 + mk_child testrepo child2 &&
1022 + (
1023 + cd testrepo &&
1024 + git tag testTag &&
1025 + git -C ../child1 fetch origin tag testTag &&
1026 + >file1 &&
1027 + git add file1 &&
1028 + git commit -m 'file1' &&
1029 + git tag $tag_args testTag &&
1030 + git -C ../child1 fetch origin tag testTag
1031 + )
1032 + "
1033 +}
1034 +
1035 +test_force_fetch_tag "lightweight tag" "-f"
1036 +test_force_fetch_tag "annotated tag" "-f -a -m'tag message'"
1037 +
1038 test_expect_success 'push --porcelain' '
1039 mk_empty testrepo &&
1040 echo >.git/foo "To testrepo" &&