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>
This commit is contained in:
		 brian m. carlson
					brian m. carlson
				
			
				
					committed by
					
						 Junio C Hamano
						Junio C Hamano
					
				
			
			
				
	
			
			
			 Junio C Hamano
						Junio C Hamano
					
				
			
						parent
						
							bd981d5fc3
						
					
				
				
					commit
					2ece6ad281
				
			| @ -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 () { | compare_diff_raw () { | ||||||
|     # When heuristics are improved, the score numbers would change. |     # When heuristics are improved, the score numbers would change. | ||||||
|     # Ignore them while comparing. |     # Ignore them while comparing. | ||||||
| @ -12,7 +12,7 @@ compare_diff_raw () { | |||||||
|     test_cmp .tmp-1 .tmp-2 && rm -f .tmp-1 .tmp-2 |     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 () { | compare_diff_raw_z () { | ||||||
|     # When heuristics are improved, the score numbers would change. |     # When heuristics are improved, the score numbers would change. | ||||||
|     # Ignore them while comparing. |     # Ignore them while comparing. | ||||||
|  | |||||||
| @ -9,7 +9,7 @@ cache-tree extension. | |||||||
|  |  | ||||||
| cmp_cache_tree () { | cmp_cache_tree () { | ||||||
| 	test-tool dump-cache-tree | sed -e '/#(ref)/d' >actual && | 	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 | 	test_cmp "$1" filtered | ||||||
| } | } | ||||||
|  |  | ||||||
|  | |||||||
| @ -128,7 +128,7 @@ cat >expected <<\EOF | |||||||
| EOF | EOF | ||||||
|  |  | ||||||
| check_result () { | 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 | 	test_cmp expected current | ||||||
| } | } | ||||||
|  |  | ||||||
|  | |||||||
| @ -30,7 +30,7 @@ read_tree_twoway () { | |||||||
| compare_change () { | compare_change () { | ||||||
| 	sed -n >current \ | 	sed -n >current \ | ||||||
| 	    -e '/^--- /d; /^+++ /d; /^@@ /d;' \ | 	    -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" | 	    "$1" | ||||||
| 	test_cmp expected current | 	test_cmp expected current | ||||||
| } | } | ||||||
|  | |||||||
| @ -16,7 +16,7 @@ compare_change () { | |||||||
| 	    -e '1{/^diff --git /d;}' \ | 	    -e '1{/^diff --git /d;}' \ | ||||||
| 	    -e '2{/^index /d;}' \ | 	    -e '2{/^index /d;}' \ | ||||||
| 	    -e '/^--- /d; /^+++ /d; /^@@ /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 | 	test_cmp expected current | ||||||
| } | } | ||||||
|  |  | ||||||
|  | |||||||
| @ -32,7 +32,7 @@ settree () { | |||||||
|  |  | ||||||
| checkindex () { | checkindex () { | ||||||
| 	git ls-files -s | | 	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 && | 	cat >expect && | ||||||
| 	test_cmp expect current | 	test_cmp expect current | ||||||
| } | } | ||||||
|  | |||||||
| @ -32,7 +32,7 @@ test_expect_success \ | |||||||
|      echo $tree' |      echo $tree' | ||||||
|  |  | ||||||
| test_output () { | test_output () { | ||||||
|     sed -e "s/ $_x40	/ X	/" <current >check |     sed -e "s/ $OID_REGEX	/ X	/" <current >check | ||||||
|     test_cmp expected check |     test_cmp expected check | ||||||
| } | } | ||||||
|  |  | ||||||
|  | |||||||
| @ -40,7 +40,7 @@ test_expect_success 'setup' ' | |||||||
| ' | ' | ||||||
|  |  | ||||||
| test_output () { | test_output () { | ||||||
| 	sed -e "s/ $_x40	/ X	/" <current >check && | 	sed -e "s/ $OID_REGEX	/ X	/" <current >check && | ||||||
| 	test_cmp expected check | 	test_cmp expected check | ||||||
| } | } | ||||||
|  |  | ||||||
|  | |||||||
| @ -122,7 +122,7 @@ test_expect_success '--quit keeps HEAD and conflicted index intact' ' | |||||||
| 	{ | 	{ | ||||||
| 		git rev-list HEAD | | 		git rev-list HEAD | | ||||||
| 		git diff-tree --root --stdin | | 		git diff-tree --root --stdin | | ||||||
| 		sed "s/$_x40/OBJID/g" | 		sed "s/$OID_REGEX/OBJID/g" | ||||||
| 	} >actual && | 	} >actual && | ||||||
| 	test_cmp expect 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 rev-list HEAD | | ||||||
| 		git diff-tree --root --stdin | | 		git diff-tree --root --stdin | | ||||||
| 		sed "s/$_x40/OBJID/g" | 		sed "s/$OID_REGEX/OBJID/g" | ||||||
| 	} >actual && | 	} >actual && | ||||||
| 	cat >expect <<-\EOF && | 	cat >expect <<-\EOF && | ||||||
| 	OBJID | 	OBJID | ||||||
| @ -317,7 +317,7 @@ test_expect_success '--continue after resolving conflicts' ' | |||||||
| 	{ | 	{ | ||||||
| 		git rev-list HEAD | | 		git rev-list HEAD | | ||||||
| 		git diff-tree --root --stdin | | 		git diff-tree --root --stdin | | ||||||
| 		sed "s/$_x40/OBJID/g" | 		sed "s/$OID_REGEX/OBJID/g" | ||||||
| 	} >actual.log && | 	} >actual.log && | ||||||
| 	test_cmp expect foo && | 	test_cmp expect foo && | ||||||
| 	test_cmp expect.log actual.log | 	test_cmp expect.log actual.log | ||||||
| @ -334,7 +334,7 @@ test_expect_success '--continue after resolving conflicts and committing' ' | |||||||
| 	{ | 	{ | ||||||
| 		git rev-list HEAD | | 		git rev-list HEAD | | ||||||
| 		git diff-tree --root --stdin | | 		git diff-tree --root --stdin | | ||||||
| 		sed "s/$_x40/OBJID/g" | 		sed "s/$OID_REGEX/OBJID/g" | ||||||
| 	} >actual && | 	} >actual && | ||||||
| 	cat >expect <<-\EOF && | 	cat >expect <<-\EOF && | ||||||
| 	OBJID | 	OBJID | ||||||
|  | |||||||
| @ -131,7 +131,7 @@ cmp_diff_files_output () { | |||||||
|     # object ID for the changed files because it wants you to look at the |     # object ID for the changed files because it wants you to look at the | ||||||
|     # filesystem. |     # filesystem. | ||||||
|     sed <"$2" >.test-tmp \ |     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 |     test_cmp "$1" .test-tmp | ||||||
| } | } | ||||||
|  |  | ||||||
|  | |||||||
| @ -8,7 +8,7 @@ test_description='Test mode change diffs. | |||||||
| ' | ' | ||||||
| . ./test-lib.sh | . ./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' ' | test_expect_success 'setup' ' | ||||||
| 	echo frotz >rezrov && | 	echo frotz >rezrov && | ||||||
|  | |||||||
| @ -1530,7 +1530,7 @@ test_expect_success 'format-patch --zero-commit' ' | |||||||
| test_expect_success 'From line has expected format' ' | test_expect_success 'From line has expected format' ' | ||||||
| 	git format-patch --stdout v2..v1 >patch2 && | 	git format-patch --stdout v2..v1 >patch2 && | ||||||
| 	grep "^From " patch2 >from && | 	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 | 	test_cmp from filtered | ||||||
| ' | ' | ||||||
|  |  | ||||||
|  | |||||||
| @ -59,7 +59,7 @@ test_expect_success 'setup' ' | |||||||
| fuzz() { | fuzz() { | ||||||
| 	file=$1 && | 	file=$1 && | ||||||
| 	sed " | 	sed " | ||||||
| 			s/$_x40/OBJECT_NAME/g | 			s/$OID_REGEX/OBJECT_NAME/g | ||||||
| 			s/$_x35/OBJID/g | 			s/$_x35/OBJID/g | ||||||
| 			s/^ \{6\}[CTa].*/      SUBJECT/g | 			s/^ \{6\}[CTa].*/      SUBJECT/g | ||||||
| 			s/^ \{8\}[^ ].*/        CONTINUATION/g | 			s/^ \{8\}[^ ].*/        CONTINUATION/g | ||||||
|  | |||||||
| @ -81,7 +81,7 @@ test_expect_success 'setup: two scripts for reading pull requests' ' | |||||||
| 	cat <<-EOT >fuzz.sed | 	cat <<-EOT >fuzz.sed | ||||||
| 	#!/bin/sed -nf | 	#!/bin/sed -nf | ||||||
| 	s/$downstream_url_for_sed/URL/g | 	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/A U Thor/AUTHOR/g | ||||||
| 	s/[-0-9]\{10\} [:0-9]\{8\} [-+][0-9]\{4\}/DATE/g | 	s/[-0-9]\{10\} [:0-9]\{8\} [-+][0-9]\{4\}/DATE/g | ||||||
| 	s/        [^ ].*/        SUBJECT/g | 	s/        [^ ].*/        SUBJECT/g | ||||||
|  | |||||||
| @ -447,8 +447,8 @@ test_expect_success '--abbrev' ' | |||||||
| 	git log -1 --format="%h %h %h" HEAD >actual1 && | 	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 >actual2 && | ||||||
| 	git log -1 --abbrev=5 --format="%H %H %H" HEAD >actual3 && | 	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/$OID_REGEX/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" <actual3 >fuzzy3 && | ||||||
| 	test_cmp expect2 fuzzy2 && | 	test_cmp expect2 fuzzy2 && | ||||||
| 	test_cmp expect3 fuzzy3 && | 	test_cmp expect3 fuzzy3 && | ||||||
| 	! test_cmp actual1 actual2 | 	! test_cmp actual1 actual2 | ||||||
|  | |||||||
| @ -9,7 +9,7 @@ note () { | |||||||
| } | } | ||||||
|  |  | ||||||
| unnote () { | 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 ' | test_expect_success setup ' | ||||||
|  | |||||||
| @ -20,7 +20,7 @@ note () { | |||||||
| } | } | ||||||
|  |  | ||||||
| unnote () { | 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 ' | test_expect_success setup ' | ||||||
|  | |||||||
| @ -18,7 +18,7 @@ test_create_repo_with_commit () { | |||||||
| } | } | ||||||
|  |  | ||||||
| sanitize_output () { | 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 | 	mv output2 output | ||||||
| } | } | ||||||
|  |  | ||||||
|  | |||||||
| @ -473,7 +473,7 @@ test_expect_failure 'change file mode but keep old content' ' | |||||||
| 	{ | 	{ | ||||||
| 		git rev-list HEAD | | 		git rev-list HEAD | | ||||||
| 		git diff-tree --root --stdin | | 		git diff-tree --root --stdin | | ||||||
| 		sed "s/$_x40/OBJID/g" | 		sed "s/$OID_REGEX/OBJID/g" | ||||||
| 	} >actual && | 	} >actual && | ||||||
| 	git show HEAD:greeting >actual.blob && | 	git show HEAD:greeting >actual.blob && | ||||||
| 	git show HEAD^:greeting >actual.target && | 	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 rev-list HEAD | | ||||||
| 		git diff-tree --root --stdin | | 		git diff-tree --root --stdin | | ||||||
| 		sed "s/$_x40/OBJID/g" | 		sed "s/$OID_REGEX/OBJID/g" | ||||||
| 	} >actual && | 	} >actual && | ||||||
| 	{ | 	{ | ||||||
| 		git cat-file commit HEAD | nul_to_q && | 		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 rev-list HEAD | | ||||||
| 		git diff-tree --root --stdin | | 		git diff-tree --root --stdin | | ||||||
| 		sed "s/$_x40/OBJID/g" | 		sed "s/$OID_REGEX/OBJID/g" | ||||||
| 	} >actual && | 	} >actual && | ||||||
| 	git show HEAD:greeting >actual.blob && | 	git show HEAD:greeting >actual.blob && | ||||||
| 	git show HEAD^:greeting >actual.target && | 	git show HEAD^:greeting >actual.target && | ||||||
| @ -792,7 +792,7 @@ test_expect_success 'property deltas supported' ' | |||||||
| 	{ | 	{ | ||||||
| 		git rev-list HEAD | | 		git rev-list HEAD | | ||||||
| 		git diff-tree --stdin | | 		git diff-tree --stdin | | ||||||
| 		sed "s/$_x40/OBJID/g" | 		sed "s/$OID_REGEX/OBJID/g" | ||||||
| 	} >actual && | 	} >actual && | ||||||
| 	test_cmp expect actual | 	test_cmp expect actual | ||||||
| ' | ' | ||||||
| @ -846,7 +846,7 @@ test_expect_success 'properties on /' ' | |||||||
| 	{ | 	{ | ||||||
| 		git rev-list HEAD | | 		git rev-list HEAD | | ||||||
| 		git diff-tree --root --always --stdin | | 		git diff-tree --root --always --stdin | | ||||||
| 		sed "s/$_x40/OBJID/g" | 		sed "s/$OID_REGEX/OBJID/g" | ||||||
| 	} >actual && | 	} >actual && | ||||||
| 	test_cmp expect actual | 	test_cmp expect actual | ||||||
| ' | ' | ||||||
| @ -931,7 +931,7 @@ test_expect_success 'deltas for typechange' ' | |||||||
| 	{ | 	{ | ||||||
| 		git rev-list HEAD | | 		git rev-list HEAD | | ||||||
| 		git diff-tree --root --stdin | | 		git diff-tree --root --stdin | | ||||||
| 		sed "s/$_x40/OBJID/g" | 		sed "s/$OID_REGEX/OBJID/g" | ||||||
| 	} >actual && | 	} >actual && | ||||||
| 	test_cmp expect actual | 	test_cmp expect actual | ||||||
| ' | ' | ||||||
| @ -1030,7 +1030,7 @@ test_expect_success 'deltas need not consume the whole preimage' ' | |||||||
| 	{ | 	{ | ||||||
| 		git rev-list HEAD | | 		git rev-list HEAD | | ||||||
| 		git diff-tree --root --stdin | | 		git diff-tree --root --stdin | | ||||||
| 		sed "s/$_x40/OBJID/g" | 		sed "s/$OID_REGEX/OBJID/g" | ||||||
| 	} >actual && | 	} >actual && | ||||||
| 	test_cmp expect actual && | 	test_cmp expect actual && | ||||||
| 	git show HEAD:postimage >actual.3 && | 	git show HEAD:postimage >actual.3 && | ||||||
|  | |||||||
| @ -1185,7 +1185,7 @@ test_expect_success PIPE 'N: empty directory reads as missing' ' | |||||||
| 	test_cmp expect.response response && | 	test_cmp expect.response response && | ||||||
| 	git rev-list read-empty | | 	git rev-list read-empty | | ||||||
| 	git diff-tree -r --root --stdin | | 	git diff-tree -r --root --stdin | | ||||||
| 	sed "s/$_x40/OBJNAME/g" >actual && | 	sed "s/$OID_REGEX/OBJNAME/g" >actual && | ||||||
| 	test_cmp expect actual | 	test_cmp expect actual | ||||||
| ' | ' | ||||||
|  |  | ||||||
| @ -1271,7 +1271,7 @@ test_expect_success 'N: delete directory by copying' ' | |||||||
| 	git fast-import <input && | 	git fast-import <input && | ||||||
| 	git rev-list N-delete | | 	git rev-list N-delete | | ||||||
| 		git diff-tree -r --stdin --root --always | | 		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 | 	test_cmp expect actual | ||||||
| ' | ' | ||||||
|  |  | ||||||
| @ -2602,7 +2602,7 @@ test_expect_success 'R: terminating "done" within commit' ' | |||||||
| 	EOF | 	EOF | ||||||
| 	git rev-list done-ends | | 	git rev-list done-ends | | ||||||
| 	git diff-tree -r --stdin --root --always | | 	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 | 	test_cmp expect actual | ||||||
| ' | ' | ||||||
|  |  | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user