Skip to content

Commit 4772b33

Browse files
bk2204gitster
authored andcommitted
t0027: make hash size independent
Several parts of this test generate files that have specific hard-coded object IDs in them. We don't really care about what the object ID in question is, so we turn them all to zeros. However, because some of these values are fixed and some are generated, they can be of different lengths, which causes problems when running with SHA-256. Furthermore, some assertions in this test use only fixed object IDs and some use both fixed and generated ones, so converting only the expected results fixes some tests while breaking others. Convert both actual and expected object IDs to the all-zeros object ID of the appropriate length to ensure that the test passes when using SHA-256. The astute observer will notice that both tr and sed are used here. Converting the tr call to a sed y/// command looks logical at first, but it isn't possible because POSIX doesn't allow escapes in y/// commands other than "\\" and "\n". Signed-off-by: brian m. carlson <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 0795aed commit 4772b33

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

t/t0027-auto-crlf.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,10 @@ compare_ws_file () {
1515
pfx=$1
1616
exp=$2.expect
1717
act=$pfx.actual.$3
18-
tr '\015\000abcdef0123456789' QN00000000000000000 <"$2" >"$exp" &&
19-
tr '\015\000abcdef0123456789' QN00000000000000000 <"$3" >"$act" &&
18+
tr '\015\000abcdef0123456789' QN00000000000000000 <"$2" |
19+
sed -e "s/0000*/$ZERO_OID/" >"$exp" &&
20+
tr '\015\000abcdef0123456789' QN00000000000000000 <"$3" |
21+
sed -e "s/0000*/$ZERO_OID/" >"$act" &&
2022
test_cmp "$exp" "$act" &&
2123
rm "$exp" "$act"
2224
}

0 commit comments

Comments
 (0)