t3305: make hash size independent

Instead of hard-coding 40-character shell patterns, use grep to determine if all of the paths have either zero or one levels of fanout, as appropriate. Note that the final test is implicitly dependent on the hash algorithm. Depending on the algorithm in use, the fanout may or may not completely compress. In its current state, this is not a problem, but it could be if the hash algorithm changes again. Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>

brian m. carlson committed Aug 18, 2019 at 19:16 UTC e3e9d02e35c2d29e9249c99e0efc6213cfaf1557
1 file changed +6 -16
t/t3305-notes-fanout.sh
+6 -16
@@ -35,15 +35,10 @@ test_expect_success 'many notes created with git-notes triggers fanout' '
35 git ls-tree -r --name-only refs/notes/commits |
36 while read path
37 do
38 - case "$path" in
39 - ??/??????????????????????????????????????)
40 - : true
41 - ;;
42 - *)
38 + echo $path | grep "^../[0-9a-f]*$" || {
39 echo "Invalid path \"$path\"" &&
44 - return 1
45 - ;;
46 - esac
40 + return 1;
41 + }
42 done
43 '
44
@@ -77,15 +72,10 @@ test_expect_success 'deleting most notes triggers fanout consolidation' '
72 git ls-tree -r --name-only refs/notes/commits |
73 while read path
74 do
80 - case "$path" in
81 - ????????????????????????????????????????)
82 - : true
83 - ;;
84 - *)
75 + echo $path | grep -v "^../.*" || {
76 echo "Invalid path \"$path\"" &&
86 - return 1
87 - ;;
88 - esac
77 + return 1;
78 + }
79 done
80 '
81