t: switch $_x40 to $OID_REGEX
authorbrian m. carlson <sandals@crustytoothpaste.net>
Sun, 13 May 2018 02:24:15 +0000 (02:24 +0000)
committerJunio C Hamano <gitster@pobox.com>
Mon, 14 May 2018 02:02:01 +0000 (11:02 +0900)
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>
20 files changed:
t/diff-lib.sh
t/t0090-cache-tree.sh
t/t1000-read-tree-m-3way.sh
t/t1001-read-tree-m-2way.sh
t/t1002-read-tree-m-u-2way.sh
t/t1012-read-tree-df.sh
t/t3100-ls-tree-restrict.sh
t/t3101-ls-tree-dirname.sh
t/t3510-cherry-pick-sequence.sh
t/t4002-diff-basic.sh
t/t4006-diff-mode.sh
t/t4014-format-patch.sh
t/t4201-shortlog.sh
t/t5150-request-pull.sh
t/t6006-rev-list-format.sh
t/t6012-rev-list-simplify.sh
t/t6111-rev-list-treesame.sh
t/t7506-status-submodule.sh
t/t9010-svn-fe.sh
t/t9300-fast-import.sh
index c211dc40eed98fc58c953d2e3b1f7ba752f98a02..2de880f7a5b0642e0bcfb6fad97a8ff462c29392 100644 (file)
@@ -1,6 +1,6 @@
 :
 
-sanitize_diff_raw='/^:/s/ '"\($_x40\)"' '"\($_x40\)"' \([A-Z]\)[0-9]*  / \1 \2 \3#     /'
+sanitize_diff_raw='/^:/s/ '"\($OID_REGEX\)"' '"\($OID_REGEX\)"' \([A-Z]\)[0-9]*        / \1 \2 \3#     /'
 compare_diff_raw () {
     # When heuristics are improved, the score numbers would change.
     # Ignore them while comparing.
@@ -12,7 +12,7 @@ compare_diff_raw () {
     test_cmp .tmp-1 .tmp-2 && rm -f .tmp-1 .tmp-2
 }
 
-sanitize_diff_raw_z='/^:/s/ '"$_x40"' '"$_x40"' \([A-Z]\)[0-9]*$/ X X \1#/'
+sanitize_diff_raw_z='/^:/s/ '"$OID_REGEX"' '"$OID_REGEX"' \([A-Z]\)[0-9]*$/ X X \1#/'
 compare_diff_raw_z () {
     # When heuristics are improved, the score numbers would change.
     # Ignore them while comparing.
index 4ae0995cd9140d3030da7d975c74ff3d9e55b039..0c61268fd22ade66c6cbd91ad743986b33af0d5d 100755 (executable)
@@ -9,7 +9,7 @@ cache-tree extension.
 
 cmp_cache_tree () {
        test-tool dump-cache-tree | sed -e '/#(ref)/d' >actual &&
-       sed "s/$_x40/SHA/" <actual >filtered &&
+       sed "s/$OID_REGEX/SHA/" <actual >filtered &&
        test_cmp "$1" filtered
 }
 
index 3c4d2d6045bf026cf164374a41ae759d08a69bf8..013c5a7bc32849eaa1c2fe7dea007d2788e3ea8a 100755 (executable)
@@ -128,7 +128,7 @@ cat >expected <<\EOF
 EOF
 
 check_result () {
-       git ls-files --stage | sed -e 's/ '"$_x40"' / X /' >current &&
+       git ls-files --stage | sed -e 's/ '"$OID_REGEX"' / X /' >current &&
        test_cmp expected current
 }
 
index 5ededd8e400e7e64faa1bd559d67251ecbf8608e..1057a96b2498d1a8abf87f21f90d108eee2c2f96 100755 (executable)
@@ -30,7 +30,7 @@ read_tree_twoway () {
 compare_change () {
        sed -n >current \
            -e '/^--- /d; /^+++ /d; /^@@ /d;' \
-           -e 's/^\([-+][0-7][0-7][0-7][0-7][0-7][0-7]\) '"$_x40"' /\1 X /p' \
+           -e 's/^\([-+][0-7][0-7][0-7][0-7][0-7][0-7]\) '"$OID_REGEX"' /\1 X /p' \
            "$1"
        test_cmp expected current
 }
index 7ca2e65d102afd76dc4136a9f12c53a5ba0fce25..9c05f5e1f510664ca6ecce60eab5ffe1a30a58ef 100755 (executable)
@@ -16,7 +16,7 @@ compare_change () {
            -e '1{/^diff --git /d;}' \
            -e '2{/^index /d;}' \
            -e '/^--- /d; /^+++ /d; /^@@ /d;' \
-           -e 's/^\(.[0-7][0-7][0-7][0-7][0-7][0-7]\) '"$_x40"' /\1 X /' "$1"
+           -e 's/^\(.[0-7][0-7][0-7][0-7][0-7][0-7]\) '"$OID_REGEX"' /\1 X /' "$1"
        test_cmp expected current
 }
 
index a6a04b6b90d290a445ed7c33e5928a9a168ed28b..57f0770df1410ea2005d8637323ff0eeeb82d880 100755 (executable)
@@ -32,7 +32,7 @@ settree () {
 
 checkindex () {
        git ls-files -s |
-       sed "s|^[0-7][0-7]* $_x40 \([0-3]\)     |\1 |" >current &&
+       sed "s|^[0-7][0-7]* $OID_REGEX \([0-3]\)        |\1 |" >current &&
        cat >expect &&
        test_cmp expect current
 }
index 325114f8fee810ac9cf1836f50e060f69b5fe46e..18baf49a49c792952f3c8028cafc2d193d88cb5d 100755 (executable)
@@ -32,7 +32,7 @@ test_expect_success \
      echo $tree'
 
 test_output () {
-    sed -e "s/ $_x40   / X     /" <current >check
+    sed -e "s/ $OID_REGEX      / X     /" <current >check
     test_cmp expected check
 }
 
index 327ded4000b47cf3f4da42515fb803c47c0bd742..12bf31022a871c4d2e43866ec6053c55205a3476 100755 (executable)
@@ -40,7 +40,7 @@ test_expect_success 'setup' '
 '
 
 test_output () {
-       sed -e "s/ $_x40        / X     /" <current >check &&
+       sed -e "s/ $OID_REGEX   / X     /" <current >check &&
        test_cmp expected check
 }
 
index 21b4f194a2466b64023017b9711473f15187c638..b42cd66d3a574138148a311b34472506b433c286 100755 (executable)
@@ -122,7 +122,7 @@ test_expect_success '--quit keeps HEAD and conflicted index intact' '
        {
                git rev-list HEAD |
                git diff-tree --root --stdin |
-               sed "s/$_x40/OBJID/g"
+               sed "s/$OID_REGEX/OBJID/g"
        } >actual &&
        test_cmp expect actual
 '
@@ -220,7 +220,7 @@ test_expect_success 'cherry-pick still writes sequencer state when one commit is
        {
                git rev-list HEAD |
                git diff-tree --root --stdin |
-               sed "s/$_x40/OBJID/g"
+               sed "s/$OID_REGEX/OBJID/g"
        } >actual &&
        cat >expect <<-\EOF &&
        OBJID
@@ -317,7 +317,7 @@ test_expect_success '--continue after resolving conflicts' '
        {
                git rev-list HEAD |
                git diff-tree --root --stdin |
-               sed "s/$_x40/OBJID/g"
+               sed "s/$OID_REGEX/OBJID/g"
        } >actual.log &&
        test_cmp expect foo &&
        test_cmp expect.log actual.log
@@ -334,7 +334,7 @@ test_expect_success '--continue after resolving conflicts and committing' '
        {
                git rev-list HEAD |
                git diff-tree --root --stdin |
-               sed "s/$_x40/OBJID/g"
+               sed "s/$OID_REGEX/OBJID/g"
        } >actual &&
        cat >expect <<-\EOF &&
        OBJID
index 5af773d6f7d6bda468e35dc32c49a81382fe8b8a..3a6c21e8251b84b2979ac7fc5d730a3155b624b4 100755 (executable)
@@ -131,7 +131,7 @@ cmp_diff_files_output () {
     # object ID for the changed files because it wants you to look at the
     # filesystem.
     sed <"$2" >.test-tmp \
-       -e '/^:000000 /d;s/'$_x40'\( [MCRNDU][0-9]*\)   /'$ZERO_OID'\1  /' &&
+       -e '/^:000000 /d;s/'$OID_REGEX'\( [MCRNDU][0-9]*\)      /'$ZERO_OID'\1  /' &&
     test_cmp "$1" .test-tmp
 }
 
index 76f643b2c2a2c7e307135de6942cf46743b6cbef..a8e01eccd158131118019ca7c9b05d08a65d07e3 100755 (executable)
@@ -8,7 +8,7 @@ test_description='Test mode change diffs.
 '
 . ./test-lib.sh
 
-sed_script='s/\(:100644 100755\) \('"$_x40"'\) \2 /\1 X X /'
+sed_script='s/\(:100644 100755\) \('"$OID_REGEX"'\) \2 /\1 X X /'
 
 test_expect_success 'setup' '
        echo frotz >rezrov &&
index 0dbf7d5b4bb489a55ec7a85f0e140e2ab43a102c..dac3f349a3247004d9375a0f6f96befc5c00cf9c 100755 (executable)
@@ -1530,7 +1530,7 @@ test_expect_success 'format-patch --zero-commit' '
 test_expect_success 'From line has expected format' '
        git format-patch --stdout v2..v1 >patch2 &&
        grep "^From " patch2 >from &&
-       grep "^From $_x40 Mon Sep 17 00:00:00 2001$" patch2 >filtered &&
+       grep "^From $OID_REGEX Mon Sep 17 00:00:00 2001$" patch2 >filtered &&
        test_cmp from filtered
 '
 
index ff6649ed9a70721523da3c55142a9622b152243a..58c27736762dde372408a4dacfb030f0e1a55b99 100755 (executable)
@@ -59,7 +59,7 @@ test_expect_success 'setup' '
 fuzz() {
        file=$1 &&
        sed "
-                       s/$_x40/OBJECT_NAME/g
+                       s/$OID_REGEX/OBJECT_NAME/g
                        s/$_x35/OBJID/g
                        s/^ \{6\}[CTa].*/      SUBJECT/g
                        s/^ \{8\}[^ ].*/        CONTINUATION/g
index 08c210f03586ab8cd26d69cb0761180ef5588f58..fca001eb9bb5767b1aff6439dbc98e49ed3aaef8 100755 (executable)
@@ -81,7 +81,7 @@ test_expect_success 'setup: two scripts for reading pull requests' '
        cat <<-EOT >fuzz.sed
        #!/bin/sed -nf
        s/$downstream_url_for_sed/URL/g
-       s/$_x40/OBJECT_NAME/g
+       s/$OID_REGEX/OBJECT_NAME/g
        s/A U Thor/AUTHOR/g
        s/[-0-9]\{10\} [:0-9]\{8\} [-+][0-9]\{4\}/DATE/g
        s/        [^ ].*/        SUBJECT/g
index 98be78b4a2123cad7e16911ae2eedff5695ba3d3..ec42c2f7797c38f39bb3420402d975a94217d1f4 100755 (executable)
@@ -447,8 +447,8 @@ test_expect_success '--abbrev' '
        git log -1 --format="%h %h %h" HEAD >actual1 &&
        git log -1 --abbrev=5 --format="%h %h %h" HEAD >actual2 &&
        git log -1 --abbrev=5 --format="%H %H %H" HEAD >actual3 &&
-       sed -e "s/$_x40/LONG/g" -e "s/$_x05/SHORT/g" <actual2 >fuzzy2 &&
-       sed -e "s/$_x40/LONG/g" -e "s/$_x05/SHORT/g" <actual3 >fuzzy3 &&
+       sed -e "s/$OID_REGEX/LONG/g" -e "s/$_x05/SHORT/g" <actual2 >fuzzy2 &&
+       sed -e "s/$OID_REGEX/LONG/g" -e "s/$_x05/SHORT/g" <actual3 >fuzzy3 &&
        test_cmp expect2 fuzzy2 &&
        test_cmp expect3 fuzzy3 &&
        ! test_cmp actual1 actual2
index 2a0fbb87b1d63f1a07f8a3934e1546c695a73f56..b5a1190ffe63b53d8b637b39a15d3d94b3efa6cd 100755 (executable)
@@ -9,7 +9,7 @@ note () {
 }
 
 unnote () {
-       git name-rev --tags --stdin | sed -e "s|$_x40 (tags/\([^)]*\)) |\1 |g"
+       git name-rev --tags --stdin | sed -e "s|$OID_REGEX (tags/\([^)]*\)) |\1 |g"
 }
 
 test_expect_success setup '
index 32474c23d3e53beda92477c5f126322901f68c53..4244638285bbf97a7e5f47e4efcd4bd3717cf49f 100755 (executable)
@@ -20,7 +20,7 @@ note () {
 }
 
 unnote () {
-       git name-rev --tags --stdin | sed -e "s|$_x40 (tags/\([^)]*\))\([       ]\)|\1\2|g"
+       git name-rev --tags --stdin | sed -e "s|$OID_REGEX (tags/\([^)]*\))\([  ]\)|\1\2|g"
 }
 
 test_expect_success setup '
index 9edf6572ed3b8f04ef1169f545043fcb2e09fe21..b4b74dbe29dd53ae8029cec20be4b6fef2cd6a1e 100755 (executable)
@@ -18,7 +18,7 @@ test_create_repo_with_commit () {
 }
 
 sanitize_output () {
-       sed -e "s/$_x40/HASH/" -e "s/$_x40/HASH/" output >output2 &&
+       sed -e "s/$OID_REGEX/HASH/" -e "s/$OID_REGEX/HASH/" output >output2 &&
        mv output2 output
 }
 
index 8eaaca6f9906879f16f3658b0e04796086d4c435..0b20b07e689897326c0060ec2181f6a09fca9797 100755 (executable)
@@ -473,7 +473,7 @@ test_expect_failure 'change file mode but keep old content' '
        {
                git rev-list HEAD |
                git diff-tree --root --stdin |
-               sed "s/$_x40/OBJID/g"
+               sed "s/$OID_REGEX/OBJID/g"
        } >actual &&
        git show HEAD:greeting >actual.blob &&
        git show HEAD^:greeting >actual.target &&
@@ -573,7 +573,7 @@ test_expect_success 'NUL in log message, file content, and property name' '
        {
                git rev-list HEAD |
                git diff-tree --root --stdin |
-               sed "s/$_x40/OBJID/g"
+               sed "s/$OID_REGEX/OBJID/g"
        } >actual &&
        {
                git cat-file commit HEAD | nul_to_q &&
@@ -659,7 +659,7 @@ test_expect_success 'change file mode and reiterate content' '
        {
                git rev-list HEAD |
                git diff-tree --root --stdin |
-               sed "s/$_x40/OBJID/g"
+               sed "s/$OID_REGEX/OBJID/g"
        } >actual &&
        git show HEAD:greeting >actual.blob &&
        git show HEAD^:greeting >actual.target &&
@@ -792,7 +792,7 @@ test_expect_success 'property deltas supported' '
        {
                git rev-list HEAD |
                git diff-tree --stdin |
-               sed "s/$_x40/OBJID/g"
+               sed "s/$OID_REGEX/OBJID/g"
        } >actual &&
        test_cmp expect actual
 '
@@ -846,7 +846,7 @@ test_expect_success 'properties on /' '
        {
                git rev-list HEAD |
                git diff-tree --root --always --stdin |
-               sed "s/$_x40/OBJID/g"
+               sed "s/$OID_REGEX/OBJID/g"
        } >actual &&
        test_cmp expect actual
 '
@@ -931,7 +931,7 @@ test_expect_success 'deltas for typechange' '
        {
                git rev-list HEAD |
                git diff-tree --root --stdin |
-               sed "s/$_x40/OBJID/g"
+               sed "s/$OID_REGEX/OBJID/g"
        } >actual &&
        test_cmp expect actual
 '
@@ -1030,7 +1030,7 @@ test_expect_success 'deltas need not consume the whole preimage' '
        {
                git rev-list HEAD |
                git diff-tree --root --stdin |
-               sed "s/$_x40/OBJID/g"
+               sed "s/$OID_REGEX/OBJID/g"
        } >actual &&
        test_cmp expect actual &&
        git show HEAD:postimage >actual.3 &&
index dc79df7b042b75ca192ff1a860eb0c22a9059a8e..9e7f96223dc2222c48b172711b4b469ff08190c8 100755 (executable)
@@ -1185,7 +1185,7 @@ test_expect_success PIPE 'N: empty directory reads as missing' '
        test_cmp expect.response response &&
        git rev-list read-empty |
        git diff-tree -r --root --stdin |
-       sed "s/$_x40/OBJNAME/g" >actual &&
+       sed "s/$OID_REGEX/OBJNAME/g" >actual &&
        test_cmp expect actual
 '
 
@@ -1271,7 +1271,7 @@ test_expect_success 'N: delete directory by copying' '
        git fast-import <input &&
        git rev-list N-delete |
                git diff-tree -r --stdin --root --always |
-               sed -e "s/$_x40/OBJID/g" >actual &&
+               sed -e "s/$OID_REGEX/OBJID/g" >actual &&
        test_cmp expect actual
 '
 
@@ -2602,7 +2602,7 @@ test_expect_success 'R: terminating "done" within commit' '
        EOF
        git rev-list done-ends |
        git diff-tree -r --stdin --root --always |
-       sed -e "s/$_x40/OBJID/g" >actual &&
+       sed -e "s/$OID_REGEX/OBJID/g" >actual &&
        test_cmp expect actual
 '