From: Junio C Hamano Date: Fri, 11 Nov 2016 21:56:30 +0000 (-0800) Subject: Merge branch 'ls/filter-process' X-Git-Tag: v2.11.0-rc1~6 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/b18f6a00662524443cfb82f5fed7d3b54524c8ab?ds=inline;hp=-c Merge branch 'ls/filter-process' Test portability improvements and optimization for an already-graduated topic. * ls/filter-process: t0021: remove debugging cruft --- b18f6a00662524443cfb82f5fed7d3b54524c8ab diff --combined t/t0021-conversion.sh index 9ff502773d,5ce2535017..da1ad3e70e --- a/t/t0021-conversion.sh +++ b/t/t0021-conversion.sh @@@ -5,16 -5,14 +5,16 @@@ test_description='blob conversion via g . ./test-lib.sh TEST_ROOT="$(pwd)" +PATH=$TEST_ROOT:$PATH -cat <"$TEST_ROOT/rot13.sh" -#!$SHELL_PATH +write_script <<\EOF "$TEST_ROOT/rot13.sh" tr \ 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ' \ 'nopqrstuvwxyzabcdefghijklmNOPQRSTUVWXYZABCDEFGHIJKLM' EOF -chmod +x "$TEST_ROOT/rot13.sh" + +write_script rot13-filter.pl "$PERL_PATH" \ + <"$TEST_DIRECTORY"/t0021/rot13-filter.pl generate_random_characters () { LEN=$1 @@@ -29,8 -27,7 +29,7 @@@ file_size () filter_git () { rm -f rot13-filter.log && - git "$@" 2>git-stderr.log && - rm -f git-stderr.log + git "$@" } # Compare two files and ensure that `clean` and `smudge` respectively are @@@ -67,7 -64,7 +66,7 @@@ test_cmp_exclude_clean () # is equal to the committed content. test_cmp_committed_rot13 () { test_cmp "$1" "$2" && - "$TEST_ROOT/rot13.sh" <"$1" >expected && + rot13.sh <"$1" >expected && git cat-file blob :"$2" >actual && test_cmp expected actual } @@@ -343,7 -340,7 +342,7 @@@ test_expect_success 'diff does not reus ' test_expect_success PERL 'required process filter should filter data' ' - test_config_global filter.protocol.process "$TEST_DIRECTORY/t0021/rot13-filter.pl clean smudge" && + test_config_global filter.protocol.process "rot13-filter.pl clean smudge" && test_config_global filter.protocol.required true && rm -rf repo && mkdir repo && @@@ -436,7 -433,7 +435,7 @@@ test_expect_success PERL 'required process filter takes precedence' ' test_config_global filter.protocol.clean false && - test_config_global filter.protocol.process "$TEST_DIRECTORY/t0021/rot13-filter.pl clean" && + test_config_global filter.protocol.process "rot13-filter.pl clean" && test_config_global filter.protocol.required true && rm -rf repo && mkdir repo && @@@ -461,7 -458,7 +460,7 @@@ ' test_expect_success PERL 'required process filter should be used only for "clean" operation only' ' - test_config_global filter.protocol.process "$TEST_DIRECTORY/t0021/rot13-filter.pl clean" && + test_config_global filter.protocol.process "rot13-filter.pl clean" && rm -rf repo && mkdir repo && ( @@@ -496,7 -493,7 +495,7 @@@ ' test_expect_success PERL 'required process filter should process multiple packets' ' - test_config_global filter.protocol.process "$TEST_DIRECTORY/t0021/rot13-filter.pl clean smudge" && + test_config_global filter.protocol.process "rot13-filter.pl clean smudge" && test_config_global filter.protocol.required true && rm -rf repo && @@@ -516,7 -513,7 +515,7 @@@ for FILE in "$TEST_ROOT"/*.file do cp "$FILE" . && - "$TEST_ROOT/rot13.sh" <"$FILE" >"$FILE.rot13" + rot13.sh <"$FILE" >"$FILE.rot13" done && echo "*.file filter=protocol" >.gitattributes && @@@ -556,7 -553,7 +555,7 @@@ ' test_expect_success PERL 'required process filter with clean error should fail' ' - test_config_global filter.protocol.process "$TEST_DIRECTORY/t0021/rot13-filter.pl clean smudge" && + test_config_global filter.protocol.process "rot13-filter.pl clean smudge" && test_config_global filter.protocol.required true && rm -rf repo && mkdir repo && @@@ -575,7 -572,7 +574,7 @@@ ' test_expect_success PERL 'process filter should restart after unexpected write failure' ' - test_config_global filter.protocol.process "$TEST_DIRECTORY/t0021/rot13-filter.pl clean smudge" && + test_config_global filter.protocol.process "rot13-filter.pl clean smudge" && rm -rf repo && mkdir repo && ( @@@ -619,14 -616,14 +618,14 @@@ # Smudge failed ! test_cmp smudge-write-fail.o smudge-write-fail.r && - "$TEST_ROOT/rot13.sh" expected && + rot13.sh expected && git cat-file blob :smudge-write-fail.r >actual && test_cmp expected actual ) ' test_expect_success PERL 'process filter should not be restarted if it signals an error' ' - test_config_global filter.protocol.process "$TEST_DIRECTORY/t0021/rot13-filter.pl clean smudge" && + test_config_global filter.protocol.process "rot13-filter.pl clean smudge" && rm -rf repo && mkdir repo && ( @@@ -665,7 -662,7 +664,7 @@@ ' test_expect_success PERL 'process filter abort stops processing of all further files' ' - test_config_global filter.protocol.process "$TEST_DIRECTORY/t0021/rot13-filter.pl clean smudge" && + test_config_global filter.protocol.process "rot13-filter.pl clean smudge" && rm -rf repo && mkdir repo && (