Skip to content

Commit 6d0a3d9

Browse files
SiddharthShrimaligitster
authored andcommitted
t7004: drop hardcoded tag count in invalid name test
The test 'trying to create a tag with a non-valid name should fail', checked that exactly one tag existed in the repository before and after attempting to create invalid tags. As pointed out by Junio, this makes the test brittle by relying on a specific global tag count. If future tests are added or removed before this test, the expected state changes and this test would break for completely unrelated reasons. Since we already use 'test_must_fail' to guarantee that the invalid tags are rejected by Git, counting the tags before and after is redundant. Drop the 'test_line_count = 1' checks so the test doesn't rely on the exact number of tags left behind by earlier tests. Suggested-by: Junio C Hamano <gitster@pobox.com> Signed-off-by: Siddharth Shrimali <r.siddharth.shrimali@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent 42148da commit 6d0a3d9

1 file changed

Lines changed: 1 addition & 5 deletions

File tree

t/t7004-tag.sh

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -191,15 +191,11 @@ test_expect_success 'trying to create a tag with the name of one existing should
191191
'
192192

193193
test_expect_success 'trying to create a tag with a non-valid name should fail' '
194-
git tag -l >actual &&
195-
test_line_count = 1 actual &&
196194
test_must_fail git tag "" &&
197195
test_must_fail git tag .othertag &&
198196
test_must_fail git tag "other tag" &&
199197
test_must_fail git tag "othertag^" &&
200-
test_must_fail git tag "other~tag" &&
201-
git tag -l >actual &&
202-
test_line_count = 1 actual
198+
test_must_fail git tag "other~tag"
203199
'
204200

205201
test_expect_success 'creating a tag using HEAD directly should succeed' '

0 commit comments

Comments
 (0)