Skip to content

Commit 0d35ccb

Browse files
avargitster
authored andcommitted
mktag tests: remove needless SHA-1 hardcoding
Change the tests amended in acb49d1 (t3800: make hash-size independent, 2019-08-18) even more to make them independent of either SHA-1 or SHA-256. Some of these tests were failing for the wrong reasons. The first one being modified here would fail because the line starts with "xxxxxx" instead of "object", the rest of the line doesn't matter. Let's just put a valid hash on the rest of the line anyway to narrow the test down for just the s/object/xxxxxx/ case. The second one being modified here would fail under GIT_TEST_DEFAULT_HASH=sha256 because <some sha-1 length garbage> is an invalid SHA-256, but we should really be testing <some sha-256 length garbage> when under SHA-256. This doesn't really matter since we should be able to trust other parts of the code to validate things in the 0-9a-f range, but let's keep it for good measure. There's a later test which tests an invalid SHA which looks like a valid one, to stress the "We refuse to tag something we can't verify[...]" logic in mktag.c. But here we're testing for a SHA-length string which contains characters outside of the /[0-9a-f]/i set. Signed-off-by: Ævar Arnfjörð Bjarmason <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent b5ca549 commit 0d35ccb

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

t/t3800-mktag.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ check_verify_failure 'Tag object length check' \
4141
# 2. object line label check
4242

4343
cat >tag.sig <<EOF
44-
xxxxxx 139e9b33986b1c2670fff52c5067603117b3e895
44+
xxxxxx $head
4545
type tag
4646
tag mytag
4747
tagger . <> 0 +0000
@@ -51,10 +51,10 @@ EOF
5151
check_verify_failure '"object" line label check' '^error: char0: .*"object "$'
5252

5353
############################################################
54-
# 3. object line SHA1 check
54+
# 3. object line hash check
5555

5656
cat >tag.sig <<EOF
57-
object zz9e9b33986b1c2670fff52c5067603117b3e895
57+
object $(echo $head | tr 0-9a-f z)
5858
type tag
5959
tag mytag
6060
tagger . <> 0 +0000

0 commit comments

Comments
 (0)