@@ -5,14 +5,16 @@ test_description='blob conversion via gitattributes'
55. ./test-lib.sh
66
77TEST_ROOT=" $( pwd) "
8+ PATH=$TEST_ROOT :$PATH
89
9- cat << EOF >"$TEST_ROOT /rot13.sh"
10- #!$SHELL_PATH
10+ write_script << \EOF "$TEST_ROOT /rot13.sh"
1111tr \
1212 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ' \
1313 'nopqrstuvwxyzabcdefghijklmNOPQRSTUVWXYZABCDEFGHIJKLM'
1414EOF
15- chmod +x " $TEST_ROOT /rot13.sh"
15+
16+ write_script rot13-filter.pl " $PERL_PATH " \
17+ < " $TEST_DIRECTORY " /t0021/rot13-filter.pl
1618
1719generate_random_characters () {
1820 LEN=$1
@@ -65,7 +67,7 @@ test_cmp_exclude_clean () {
6567# is equal to the committed content.
6668test_cmp_committed_rot13 () {
6769 test_cmp " $1 " " $2 " &&
68- " $TEST_ROOT / rot13.sh" < " $1 " > expected &&
70+ rot13.sh < " $1 " > expected &&
6971 git cat-file blob :" $2 " > actual &&
7072 test_cmp expected actual
7173}
@@ -341,7 +343,7 @@ test_expect_success 'diff does not reuse worktree files that need cleaning' '
341343'
342344
343345test_expect_success PERL ' required process filter should filter data' '
344- test_config_global filter.protocol.process "$TEST_DIRECTORY/t0021/ rot13-filter.pl clean smudge" &&
346+ test_config_global filter.protocol.process "rot13-filter.pl clean smudge" &&
345347 test_config_global filter.protocol.required true &&
346348 rm -rf repo &&
347349 mkdir repo &&
@@ -434,7 +436,7 @@ test_expect_success PERL 'required process filter should filter data' '
434436
435437test_expect_success PERL ' required process filter takes precedence' '
436438 test_config_global filter.protocol.clean false &&
437- test_config_global filter.protocol.process "$TEST_DIRECTORY/t0021/ rot13-filter.pl clean" &&
439+ test_config_global filter.protocol.process "rot13-filter.pl clean" &&
438440 test_config_global filter.protocol.required true &&
439441 rm -rf repo &&
440442 mkdir repo &&
@@ -459,7 +461,7 @@ test_expect_success PERL 'required process filter takes precedence' '
459461'
460462
461463test_expect_success PERL ' required process filter should be used only for "clean" operation only' '
462- test_config_global filter.protocol.process "$TEST_DIRECTORY/t0021/ rot13-filter.pl clean" &&
464+ test_config_global filter.protocol.process "rot13-filter.pl clean" &&
463465 rm -rf repo &&
464466 mkdir repo &&
465467 (
@@ -494,7 +496,7 @@ test_expect_success PERL 'required process filter should be used only for "clean
494496'
495497
496498test_expect_success PERL ' required process filter should process multiple packets' '
497- test_config_global filter.protocol.process "$TEST_DIRECTORY/t0021/ rot13-filter.pl clean smudge" &&
499+ test_config_global filter.protocol.process "rot13-filter.pl clean smudge" &&
498500 test_config_global filter.protocol.required true &&
499501
500502 rm -rf repo &&
@@ -514,7 +516,7 @@ test_expect_success PERL 'required process filter should process multiple packet
514516 for FILE in "$TEST_ROOT"/*.file
515517 do
516518 cp "$FILE" . &&
517- "$TEST_ROOT/ rot13.sh" <"$FILE" >"$FILE.rot13"
519+ rot13.sh <"$FILE" >"$FILE.rot13"
518520 done &&
519521
520522 echo "*.file filter=protocol" >.gitattributes &&
@@ -554,7 +556,7 @@ test_expect_success PERL 'required process filter should process multiple packet
554556'
555557
556558test_expect_success PERL ' required process filter with clean error should fail' '
557- test_config_global filter.protocol.process "$TEST_DIRECTORY/t0021/ rot13-filter.pl clean smudge" &&
559+ test_config_global filter.protocol.process "rot13-filter.pl clean smudge" &&
558560 test_config_global filter.protocol.required true &&
559561 rm -rf repo &&
560562 mkdir repo &&
@@ -573,7 +575,7 @@ test_expect_success PERL 'required process filter with clean error should fail'
573575'
574576
575577test_expect_success PERL ' process filter should restart after unexpected write failure' '
576- test_config_global filter.protocol.process "$TEST_DIRECTORY/t0021/ rot13-filter.pl clean smudge" &&
578+ test_config_global filter.protocol.process "rot13-filter.pl clean smudge" &&
577579 rm -rf repo &&
578580 mkdir repo &&
579581 (
@@ -617,14 +619,14 @@ test_expect_success PERL 'process filter should restart after unexpected write f
617619
618620 # Smudge failed
619621 ! test_cmp smudge-write-fail.o smudge-write-fail.r &&
620- "$TEST_ROOT/ rot13.sh" <smudge-write-fail.o >expected &&
622+ rot13.sh <smudge-write-fail.o >expected &&
621623 git cat-file blob :smudge-write-fail.r >actual &&
622624 test_cmp expected actual
623625 )
624626'
625627
626628test_expect_success PERL ' process filter should not be restarted if it signals an error' '
627- test_config_global filter.protocol.process "$TEST_DIRECTORY/t0021/ rot13-filter.pl clean smudge" &&
629+ test_config_global filter.protocol.process "rot13-filter.pl clean smudge" &&
628630 rm -rf repo &&
629631 mkdir repo &&
630632 (
@@ -663,7 +665,7 @@ test_expect_success PERL 'process filter should not be restarted if it signals a
663665'
664666
665667test_expect_success PERL ' process filter abort stops processing of all further files' '
666- test_config_global filter.protocol.process "$TEST_DIRECTORY/t0021/ rot13-filter.pl clean smudge" &&
668+ test_config_global filter.protocol.process "rot13-filter.pl clean smudge" &&
667669 rm -rf repo &&
668670 mkdir repo &&
669671 (
0 commit comments