@@ -5,14 +5,16 @@ test_description='blob conversion via gitattributes'
5
5
. ./test-lib.sh
6
6
7
7
TEST_ROOT=" $( pwd) "
8
+ PATH=$TEST_ROOT :$PATH
8
9
9
- cat << EOF >"$TEST_ROOT /rot13.sh"
10
- #!$SHELL_PATH
10
+ write_script << \EOF "$TEST_ROOT /rot13.sh"
11
11
tr \
12
12
'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ' \
13
13
'nopqrstuvwxyzabcdefghijklmNOPQRSTUVWXYZABCDEFGHIJKLM'
14
14
EOF
15
- chmod +x " $TEST_ROOT /rot13.sh"
15
+
16
+ write_script rot13-filter.pl " $PERL_PATH " \
17
+ < " $TEST_DIRECTORY " /t0021/rot13-filter.pl
16
18
17
19
generate_random_characters () {
18
20
LEN=$1
@@ -65,7 +67,7 @@ test_cmp_exclude_clean () {
65
67
# is equal to the committed content.
66
68
test_cmp_committed_rot13 () {
67
69
test_cmp " $1 " " $2 " &&
68
- " $TEST_ROOT / rot13.sh" < " $1 " > expected &&
70
+ rot13.sh < " $1 " > expected &&
69
71
git cat-file blob :" $2 " > actual &&
70
72
test_cmp expected actual
71
73
}
@@ -341,7 +343,7 @@ test_expect_success 'diff does not reuse worktree files that need cleaning' '
341
343
'
342
344
343
345
test_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" &&
345
347
test_config_global filter.protocol.required true &&
346
348
rm -rf repo &&
347
349
mkdir repo &&
@@ -434,7 +436,7 @@ test_expect_success PERL 'required process filter should filter data' '
434
436
435
437
test_expect_success PERL ' required process filter takes precedence' '
436
438
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" &&
438
440
test_config_global filter.protocol.required true &&
439
441
rm -rf repo &&
440
442
mkdir repo &&
@@ -459,7 +461,7 @@ test_expect_success PERL 'required process filter takes precedence' '
459
461
'
460
462
461
463
test_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" &&
463
465
rm -rf repo &&
464
466
mkdir repo &&
465
467
(
@@ -494,7 +496,7 @@ test_expect_success PERL 'required process filter should be used only for "clean
494
496
'
495
497
496
498
test_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" &&
498
500
test_config_global filter.protocol.required true &&
499
501
500
502
rm -rf repo &&
@@ -514,7 +516,7 @@ test_expect_success PERL 'required process filter should process multiple packet
514
516
for FILE in "$TEST_ROOT"/*.file
515
517
do
516
518
cp "$FILE" . &&
517
- "$TEST_ROOT/ rot13.sh" <"$FILE" >"$FILE.rot13"
519
+ rot13.sh <"$FILE" >"$FILE.rot13"
518
520
done &&
519
521
520
522
echo "*.file filter=protocol" >.gitattributes &&
@@ -554,7 +556,7 @@ test_expect_success PERL 'required process filter should process multiple packet
554
556
'
555
557
556
558
test_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" &&
558
560
test_config_global filter.protocol.required true &&
559
561
rm -rf repo &&
560
562
mkdir repo &&
@@ -573,7 +575,7 @@ test_expect_success PERL 'required process filter with clean error should fail'
573
575
'
574
576
575
577
test_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" &&
577
579
rm -rf repo &&
578
580
mkdir repo &&
579
581
(
@@ -617,14 +619,14 @@ test_expect_success PERL 'process filter should restart after unexpected write f
617
619
618
620
# Smudge failed
619
621
! 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 &&
621
623
git cat-file blob :smudge-write-fail.r >actual &&
622
624
test_cmp expected actual
623
625
)
624
626
'
625
627
626
628
test_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" &&
628
630
rm -rf repo &&
629
631
mkdir repo &&
630
632
(
@@ -663,7 +665,7 @@ test_expect_success PERL 'process filter should not be restarted if it signals a
663
665
'
664
666
665
667
test_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" &&
667
669
rm -rf repo &&
668
670
mkdir repo &&
669
671
(
0 commit comments