t: switch $_x40 to $OID_REGEX

Switch all uses of $_x40 to $OID_REGEX so that they work correctly with larger hashes. This commit was created by using the following sed command to modify all files in the t directory except t/test-lib.sh: sed -i 's/\$_x40/$OID_REGEX/g' Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>

brian m. carlson committed May 13, 2018 at 02:24 UTC 2ece6ad2819078733d8fb8a7cd47929786631ed1
20 files changed +33 -33
t/diff-lib.sh
+2 -2
@@ -1,6 +1,6 @@
1 :
2
3 -sanitize_diff_raw='/^:/s/ '"\($_x40\)"' '"\($_x40\)"' \([A-Z]\)[0-9]* / \1 \2 \3# /'
3 +sanitize_diff_raw='/^:/s/ '"\($OID_REGEX\)"' '"\($OID_REGEX\)"' \([A-Z]\)[0-9]* / \1 \2 \3# /'
4 compare_diff_raw () {
5 # When heuristics are improved, the score numbers would change.
6 # Ignore them while comparing.
@@ -12,7 +12,7 @@ compare_diff_raw () {
12 test_cmp .tmp-1 .tmp-2 && rm -f .tmp-1 .tmp-2
13 }
14
15 -sanitize_diff_raw_z='/^:/s/ '"$_x40"' '"$_x40"' \([A-Z]\)[0-9]*$/ X X \1#/'
15 +sanitize_diff_raw_z='/^:/s/ '"$OID_REGEX"' '"$OID_REGEX"' \([A-Z]\)[0-9]*$/ X X \1#/'
16 compare_diff_raw_z () {
17 # When heuristics are improved, the score numbers would change.
18 # Ignore them while comparing.
t/t0090-cache-tree.sh
+1 -1
@@ -9,7 +9,7 @@ cache-tree extension.
9
10 cmp_cache_tree () {
11 test-tool dump-cache-tree | sed -e '/#(ref)/d' >actual &&
12 - sed "s/$_x40/SHA/" <actual >filtered &&
12 + sed "s/$OID_REGEX/SHA/" <actual >filtered &&
13 test_cmp "$1" filtered
14 }
15
t/t1000-read-tree-m-3way.sh
+1 -1
@@ -128,7 +128,7 @@ cat >expected <<\EOF
128 EOF
129
130 check_result () {
131 - git ls-files --stage | sed -e 's/ '"$_x40"' / X /' >current &&
131 + git ls-files --stage | sed -e 's/ '"$OID_REGEX"' / X /' >current &&
132 test_cmp expected current
133 }
134
t/t1001-read-tree-m-2way.sh
+1 -1
@@ -30,7 +30,7 @@ read_tree_twoway () {
30 compare_change () {
31 sed -n >current \
32 -e '/^--- /d; /^+++ /d; /^@@ /d;' \
33 - -e 's/^\([-+][0-7][0-7][0-7][0-7][0-7][0-7]\) '"$_x40"' /\1 X /p' \
33 + -e 's/^\([-+][0-7][0-7][0-7][0-7][0-7][0-7]\) '"$OID_REGEX"' /\1 X /p' \
34 "$1"
35 test_cmp expected current
36 }
t/t1002-read-tree-m-u-2way.sh
+1 -1
@@ -16,7 +16,7 @@ compare_change () {
16 -e '1{/^diff --git /d;}' \
17 -e '2{/^index /d;}' \
18 -e '/^--- /d; /^+++ /d; /^@@ /d;' \
19 - -e 's/^\(.[0-7][0-7][0-7][0-7][0-7][0-7]\) '"$_x40"' /\1 X /' "$1"
19 + -e 's/^\(.[0-7][0-7][0-7][0-7][0-7][0-7]\) '"$OID_REGEX"' /\1 X /' "$1"
20 test_cmp expected current
21 }
22
t/t1012-read-tree-df.sh
+1 -1
@@ -32,7 +32,7 @@ settree () {
32
33 checkindex () {
34 git ls-files -s |
35 - sed "s|^[0-7][0-7]* $_x40 \([0-3]\) |\1 |" >current &&
35 + sed "s|^[0-7][0-7]* $OID_REGEX \([0-3]\) |\1 |" >current &&
36 cat >expect &&
37 test_cmp expect current
38 }
t/t3100-ls-tree-restrict.sh
+1 -1
@@ -32,7 +32,7 @@ test_expect_success \
32 echo $tree'
33
34 test_output () {
35 - sed -e "s/ $_x40 / X /" <current >check
35 + sed -e "s/ $OID_REGEX / X /" <current >check
36 test_cmp expected check
37 }
38
t/t3101-ls-tree-dirname.sh
+1 -1
@@ -40,7 +40,7 @@ test_expect_success 'setup' '
40 '
41
42 test_output () {
43 - sed -e "s/ $_x40 / X /" <current >check &&
43 + sed -e "s/ $OID_REGEX / X /" <current >check &&
44 test_cmp expected check
45 }
46
t/t3510-cherry-pick-sequence.sh
+4 -4
@@ -122,7 +122,7 @@ test_expect_success '--quit keeps HEAD and conflicted index intact' '
122 {
123 git rev-list HEAD |
124 git diff-tree --root --stdin |
125 - sed "s/$_x40/OBJID/g"
125 + sed "s/$OID_REGEX/OBJID/g"
126 } >actual &&
127 test_cmp expect actual
128 '
@@ -220,7 +220,7 @@ test_expect_success 'cherry-pick still writes sequencer state when one commit is
220 {
221 git rev-list HEAD |
222 git diff-tree --root --stdin |
223 - sed "s/$_x40/OBJID/g"
223 + sed "s/$OID_REGEX/OBJID/g"
224 } >actual &&
225 cat >expect <<-\EOF &&
226 OBJID
@@ -317,7 +317,7 @@ test_expect_success '--continue after resolving conflicts' '
317 {
318 git rev-list HEAD |
319 git diff-tree --root --stdin |
320 - sed "s/$_x40/OBJID/g"
320 + sed "s/$OID_REGEX/OBJID/g"
321 } >actual.log &&
322 test_cmp expect foo &&
323 test_cmp expect.log actual.log
@@ -334,7 +334,7 @@ test_expect_success '--continue after resolving conflicts and committing' '
334 {
335 git rev-list HEAD |
336 git diff-tree --root --stdin |
337 - sed "s/$_x40/OBJID/g"
337 + sed "s/$OID_REGEX/OBJID/g"
338 } >actual &&
339 cat >expect <<-\EOF &&
340 OBJID
t/t4002-diff-basic.sh
+1 -1
@@ -131,7 +131,7 @@ cmp_diff_files_output () {
131 # object ID for the changed files because it wants you to look at the
132 # filesystem.
133 sed <"$2" >.test-tmp \
134 - -e '/^:000000 /d;s/'$_x40'\( [MCRNDU][0-9]*\) /'$ZERO_OID'\1 /' &&
134 + -e '/^:000000 /d;s/'$OID_REGEX'\( [MCRNDU][0-9]*\) /'$ZERO_OID'\1 /' &&
135 test_cmp "$1" .test-tmp
136 }
137
t/t4006-diff-mode.sh
+1 -1
@@ -8,7 +8,7 @@ test_description='Test mode change diffs.
8 '
9 . ./test-lib.sh
10
11 -sed_script='s/\(:100644 100755\) \('"$_x40"'\) \2 /\1 X X /'
11 +sed_script='s/\(:100644 100755\) \('"$OID_REGEX"'\) \2 /\1 X X /'
12
13 test_expect_success 'setup' '
14 echo frotz >rezrov &&
t/t4014-format-patch.sh
+1 -1
@@ -1530,7 +1530,7 @@ test_expect_success 'format-patch --zero-commit' '
1530 test_expect_success 'From line has expected format' '
1531 git format-patch --stdout v2..v1 >patch2 &&
1532 grep "^From " patch2 >from &&
1533 - grep "^From $_x40 Mon Sep 17 00:00:00 2001$" patch2 >filtered &&
1533 + grep "^From $OID_REGEX Mon Sep 17 00:00:00 2001$" patch2 >filtered &&
1534 test_cmp from filtered
1535 '
1536
t/t4201-shortlog.sh
+1 -1
@@ -59,7 +59,7 @@ test_expect_success 'setup' '
59 fuzz() {
60 file=$1 &&
61 sed "
62 - s/$_x40/OBJECT_NAME/g
62 + s/$OID_REGEX/OBJECT_NAME/g
63 s/$_x35/OBJID/g
64 s/^ \{6\}[CTa].*/ SUBJECT/g
65 s/^ \{8\}[^ ].*/ CONTINUATION/g
t/t5150-request-pull.sh
+1 -1
@@ -81,7 +81,7 @@ test_expect_success 'setup: two scripts for reading pull requests' '
81 cat <<-EOT >fuzz.sed
82 #!/bin/sed -nf
83 s/$downstream_url_for_sed/URL/g
84 - s/$_x40/OBJECT_NAME/g
84 + s/$OID_REGEX/OBJECT_NAME/g
85 s/A U Thor/AUTHOR/g
86 s/[-0-9]\{10\} [:0-9]\{8\} [-+][0-9]\{4\}/DATE/g
87 s/ [^ ].*/ SUBJECT/g
t/t6006-rev-list-format.sh
+2 -2
@@ -447,8 +447,8 @@ test_expect_success '--abbrev' '
447 git log -1 --format="%h %h %h" HEAD >actual1 &&
448 git log -1 --abbrev=5 --format="%h %h %h" HEAD >actual2 &&
449 git log -1 --abbrev=5 --format="%H %H %H" HEAD >actual3 &&
450 - sed -e "s/$_x40/LONG/g" -e "s/$_x05/SHORT/g" <actual2 >fuzzy2 &&
451 - sed -e "s/$_x40/LONG/g" -e "s/$_x05/SHORT/g" <actual3 >fuzzy3 &&
450 + sed -e "s/$OID_REGEX/LONG/g" -e "s/$_x05/SHORT/g" <actual2 >fuzzy2 &&
451 + sed -e "s/$OID_REGEX/LONG/g" -e "s/$_x05/SHORT/g" <actual3 >fuzzy3 &&
452 test_cmp expect2 fuzzy2 &&
453 test_cmp expect3 fuzzy3 &&
454 ! test_cmp actual1 actual2
t/t6012-rev-list-simplify.sh
+1 -1
@@ -9,7 +9,7 @@ note () {
9 }
10
11 unnote () {
12 - git name-rev --tags --stdin | sed -e "s|$_x40 (tags/\([^)]*\)) |\1 |g"
12 + git name-rev --tags --stdin | sed -e "s|$OID_REGEX (tags/\([^)]*\)) |\1 |g"
13 }
14
15 test_expect_success setup '
t/t6111-rev-list-treesame.sh
+1 -1
@@ -20,7 +20,7 @@ note () {
20 }
21
22 unnote () {
23 - git name-rev --tags --stdin | sed -e "s|$_x40 (tags/\([^)]*\))\([ ]\)|\1\2|g"
23 + git name-rev --tags --stdin | sed -e "s|$OID_REGEX (tags/\([^)]*\))\([ ]\)|\1\2|g"
24 }
25
26 test_expect_success setup '
t/t7506-status-submodule.sh
+1 -1
@@ -18,7 +18,7 @@ test_create_repo_with_commit () {
18 }
19
20 sanitize_output () {
21 - sed -e "s/$_x40/HASH/" -e "s/$_x40/HASH/" output >output2 &&
21 + sed -e "s/$OID_REGEX/HASH/" -e "s/$OID_REGEX/HASH/" output >output2 &&
22 mv output2 output
23 }
24
t/t9010-svn-fe.sh
+7 -7
@@ -473,7 +473,7 @@ test_expect_failure 'change file mode but keep old content' '
473 {
474 git rev-list HEAD |
475 git diff-tree --root --stdin |
476 - sed "s/$_x40/OBJID/g"
476 + sed "s/$OID_REGEX/OBJID/g"
477 } >actual &&
478 git show HEAD:greeting >actual.blob &&
479 git show HEAD^:greeting >actual.target &&
@@ -573,7 +573,7 @@ test_expect_success 'NUL in log message, file content, and property name' '
573 {
574 git rev-list HEAD |
575 git diff-tree --root --stdin |
576 - sed "s/$_x40/OBJID/g"
576 + sed "s/$OID_REGEX/OBJID/g"
577 } >actual &&
578 {
579 git cat-file commit HEAD | nul_to_q &&
@@ -659,7 +659,7 @@ test_expect_success 'change file mode and reiterate content' '
659 {
660 git rev-list HEAD |
661 git diff-tree --root --stdin |
662 - sed "s/$_x40/OBJID/g"
662 + sed "s/$OID_REGEX/OBJID/g"
663 } >actual &&
664 git show HEAD:greeting >actual.blob &&
665 git show HEAD^:greeting >actual.target &&
@@ -792,7 +792,7 @@ test_expect_success 'property deltas supported' '
792 {
793 git rev-list HEAD |
794 git diff-tree --stdin |
795 - sed "s/$_x40/OBJID/g"
795 + sed "s/$OID_REGEX/OBJID/g"
796 } >actual &&
797 test_cmp expect actual
798 '
@@ -846,7 +846,7 @@ test_expect_success 'properties on /' '
846 {
847 git rev-list HEAD |
848 git diff-tree --root --always --stdin |
849 - sed "s/$_x40/OBJID/g"
849 + sed "s/$OID_REGEX/OBJID/g"
850 } >actual &&
851 test_cmp expect actual
852 '
@@ -931,7 +931,7 @@ test_expect_success 'deltas for typechange' '
931 {
932 git rev-list HEAD |
933 git diff-tree --root --stdin |
934 - sed "s/$_x40/OBJID/g"
934 + sed "s/$OID_REGEX/OBJID/g"
935 } >actual &&
936 test_cmp expect actual
937 '
@@ -1030,7 +1030,7 @@ test_expect_success 'deltas need not consume the whole preimage' '
1030 {
1031 git rev-list HEAD |
1032 git diff-tree --root --stdin |
1033 - sed "s/$_x40/OBJID/g"
1033 + sed "s/$OID_REGEX/OBJID/g"
1034 } >actual &&
1035 test_cmp expect actual &&
1036 git show HEAD:postimage >actual.3 &&
t/t9300-fast-import.sh
+3 -3
@@ -1185,7 +1185,7 @@ test_expect_success PIPE 'N: empty directory reads as missing' '
1185 test_cmp expect.response response &&
1186 git rev-list read-empty |
1187 git diff-tree -r --root --stdin |
1188 - sed "s/$_x40/OBJNAME/g" >actual &&
1188 + sed "s/$OID_REGEX/OBJNAME/g" >actual &&
1189 test_cmp expect actual
1190 '
1191
@@ -1271,7 +1271,7 @@ test_expect_success 'N: delete directory by copying' '
1271 git fast-import <input &&
1272 git rev-list N-delete |
1273 git diff-tree -r --stdin --root --always |
1274 - sed -e "s/$_x40/OBJID/g" >actual &&
1274 + sed -e "s/$OID_REGEX/OBJID/g" >actual &&
1275 test_cmp expect actual
1276 '
1277
@@ -2602,7 +2602,7 @@ test_expect_success 'R: terminating "done" within commit' '
2602 EOF
2603 git rev-list done-ends |
2604 git diff-tree -r --stdin --root --always |
2605 - sed -e "s/$_x40/OBJID/g" >actual &&
2605 + sed -e "s/$OID_REGEX/OBJID/g" >actual &&
2606 test_cmp expect actual
2607 '
2608