diff options
| author | Siddharth Shrimali <r.siddharth.shrimali@gmail.com> | 2026-04-21 11:03:32 +0530 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2026-04-21 00:20:41 -0700 |
| commit | 7002d6cd16047c0ed0b6befc22b5a7d54d4d6fde (patch) | |
| tree | e00788016372fa74c8d6982ae6762a19f1c1e95f /t/t4013/diff.format-patch_--inline_--stdout_initial..master^ | |
| parent | 42148dafdf74f8458e7a710dcb982c0be0e40566 (diff) | |
| download | git-7002d6cd16047c0ed0b6befc22b5a7d54d4d6fde.tar.gz git-7002d6cd16047c0ed0b6befc22b5a7d54d4d6fde.zip | |
t7004: drop hardcoded tag count for state verification
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.
Modernize the test by taking a snapshot of the existing tags before the
failure attempts and comparing it to a snapshot taken after.
This provides a "belt-and-suspenders" approach: we verify that
'git tag' both exits with the expected error code and leaves the
repository state untouched, without being brittle to the specific
number of tags present.
This replaces the hardcoded 'test_line_count = 1' checks with 'test_cmp'
to ensure the tag list remains identical.
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>
Diffstat (limited to 't/t4013/diff.format-patch_--inline_--stdout_initial..master^')
0 files changed, 0 insertions, 0 deletions
