t7004: create separate tags for different tests

Reftable intentionally keeps reflog data for deleted refs. This breaks tests that delete and recreate "refs/tags/tag_with_reflog" as traces of the deletion are left in reflog. To resolve this, use a differently named ref for each test case. Signed-off-by: Han-Wen Nienhuys <hanwen@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Han-Wen Nienhuys committed Dec 22, 2021 at 10:59 UTC be49349c72d455217f3d7fd2b7760ef51561ccf5
1 file changed +11 -11
t/t7004-tag.sh
+11 -11
@@ -94,10 +94,10 @@ test_expect_success 'creating a tag with --create-reflog should create reflog' '
94 git log -1 \
95 --format="format:tag: tagging %h (%s, %cd)%n" \
96 --date=format:%Y-%m-%d >expected &&
97 - test_when_finished "git tag -d tag_with_reflog" &&
98 - git tag --create-reflog tag_with_reflog &&
99 - git reflog exists refs/tags/tag_with_reflog &&
100 - sed -e "s/^.* //" .git/logs/refs/tags/tag_with_reflog >actual &&
97 + test_when_finished "git tag -d tag_with_reflog1" &&
98 + git tag --create-reflog tag_with_reflog1 &&
99 + git reflog exists refs/tags/tag_with_reflog1 &&
100 + sed -e "s/^.* //" .git/logs/refs/tags/tag_with_reflog1 >actual &&
101 test_cmp expected actual
102 '
103
@@ -105,10 +105,10 @@ test_expect_success 'annotated tag with --create-reflog has correct message' '
105 git log -1 \
106 --format="format:tag: tagging %h (%s, %cd)%n" \
107 --date=format:%Y-%m-%d >expected &&
108 - test_when_finished "git tag -d tag_with_reflog" &&
109 - git tag -m "annotated tag" --create-reflog tag_with_reflog &&
110 - git reflog exists refs/tags/tag_with_reflog &&
111 - sed -e "s/^.* //" .git/logs/refs/tags/tag_with_reflog >actual &&
108 + test_when_finished "git tag -d tag_with_reflog2" &&
109 + git tag -m "annotated tag" --create-reflog tag_with_reflog2 &&
110 + git reflog exists refs/tags/tag_with_reflog2 &&
111 + sed -e "s/^.* //" .git/logs/refs/tags/tag_with_reflog2 >actual &&
112 test_cmp expected actual
113 '
114
@@ -118,10 +118,10 @@ test_expect_success '--create-reflog does not create reflog on failure' '
118 '
119
120 test_expect_success 'option core.logAllRefUpdates=always creates reflog' '
121 - test_when_finished "git tag -d tag_with_reflog" &&
121 + test_when_finished "git tag -d tag_with_reflog3" &&
122 test_config core.logAllRefUpdates always &&
123 - git tag tag_with_reflog &&
124 - git reflog exists refs/tags/tag_with_reflog
123 + git tag tag_with_reflog3 &&
124 + git reflog exists refs/tags/tag_with_reflog3
125 '
126
127 test_expect_success 'listing all tags if one exists should succeed' '