Merge branch 'jk/shell-portability'
test fixes. * jk/shell-portability: t5500 & t7403: lose bash-ism "local" test-lib: add in-shell "env" replacementmaint
						commit
						45c0c21eb9
					
				|  | @ -1072,7 +1072,7 @@ test_expect_success '--from omits redundant in-body header' ' | |||
| ' | ||||
|  | ||||
| test_expect_success 'in-body headers trigger content encoding' ' | ||||
| 	GIT_AUTHOR_NAME="éxötìc" test_commit exotic && | ||||
| 	test_env GIT_AUTHOR_NAME="éxötìc" test_commit exotic && | ||||
| 	test_when_finished "git reset --hard HEAD^" && | ||||
| 	git format-patch -1 --stdout --from >patch && | ||||
| 	cat >expect <<-\EOF && | ||||
|  |  | |||
|  | @ -558,7 +558,6 @@ check_prot_path () { | |||
| } | ||||
|  | ||||
| check_prot_host_port_path () { | ||||
| 	local diagport | ||||
| 	case "$2" in | ||||
| 		*ssh*) | ||||
| 		pp=ssh | ||||
|  |  | |||
|  | @ -62,13 +62,13 @@ test_expect_success 'change submodule' ' | |||
| ' | ||||
|  | ||||
| reset_submodule_urls () { | ||||
| 	local root | ||||
| 	root=$(pwd) && | ||||
| 	( | ||||
| 		root=$(pwd) && | ||||
| 		cd super-clone/submodule && | ||||
| 		git config remote.origin.url "$root/submodule" | ||||
| 	) && | ||||
| 	( | ||||
| 		root=$(pwd) && | ||||
| 		cd super-clone/submodule/sub-submodule && | ||||
| 		git config remote.origin.url "$root/submodule" | ||||
| 	) | ||||
|  |  | |||
|  | @ -939,3 +939,25 @@ mingw_read_file_strip_cr_ () { | |||
| 		eval "$1=\$$1\$line" | ||||
| 	done | ||||
| } | ||||
|  | ||||
| # Like "env FOO=BAR some-program", but run inside a subshell, which means | ||||
| # it also works for shell functions (though those functions cannot impact | ||||
| # the environment outside of the test_env invocation). | ||||
| test_env () { | ||||
| 	( | ||||
| 		while test $# -gt 0 | ||||
| 		do | ||||
| 			case "$1" in | ||||
| 			*=*) | ||||
| 				eval "${1%%=*}=\${1#*=}" | ||||
| 				eval "export ${1%%=*}" | ||||
| 				shift | ||||
| 				;; | ||||
| 			*) | ||||
| 				"$@" | ||||
| 				exit | ||||
| 				;; | ||||
| 			esac | ||||
| 		done | ||||
| 	) | ||||
| } | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	 Junio C Hamano
						Junio C Hamano