File tree Expand file tree Collapse file tree 3 files changed +20
-18
lines changed
Expand file tree Collapse file tree 3 files changed +20
-18
lines changed Original file line number Diff line number Diff line change @@ -141,13 +141,13 @@ test_expect_success 'GIT_PREFIX for !alias' '
141141test_expect_success ' GIT_PREFIX for built-ins' '
142142 # Use GIT_EXTERNAL_DIFF to test that the "diff" built-in
143143 # receives the GIT_PREFIX variable.
144- printf "dir/" >expect &&
145- printf "#!/bin/sh\n" > diff &&
146- printf "printf \"\ $GIT_PREFIX\"" >>diff &&
147- chmod +x diff &&
144+ echo "dir/" >expect &&
145+ write_script diff <<-\EOF &&
146+ printf "%s\n" " $GIT_PREFIX"
147+ EOF
148148 (
149149 cd dir &&
150- printf "change" >two &&
150+ echo "change" >two &&
151151 GIT_EXTERNAL_DIFF=./diff git diff >../actual
152152 git checkout -- two
153153 ) &&
Original file line number Diff line number Diff line change @@ -555,10 +555,9 @@ test_expect_success 'rebase a detached HEAD' '
555555test_expect_success ' rebase a commit violating pre-commit' '
556556
557557 mkdir -p .git/hooks &&
558- PRE_COMMIT=.git/hooks/pre-commit &&
559- echo "#!/bin/sh" > $PRE_COMMIT &&
560- echo "test -z \"\$(git diff --cached --check)\"" >> $PRE_COMMIT &&
561- chmod a+x $PRE_COMMIT &&
558+ write_script .git/hooks/pre-commit <<-\EOF &&
559+ test -z "$(git diff --cached --check)"
560+ EOF
562561 echo "monde! " >> file1 &&
563562 test_tick &&
564563 test_must_fail git commit -m doesnt-verify file1 &&
Original file line number Diff line number Diff line change @@ -12,22 +12,25 @@ test_expect_success 'setup remote repo' '
1212 )
1313'
1414
15- cat > proxy << 'EOF '
16- #!/bin/sh
17- echo >&2 "proxying for $*"
18- cmd=$("$PERL_PATH" -e '
15+ test_expect_success ' setup proxy script' '
16+ write_script proxy-get-cmd "$PERL_PATH" <<-\EOF &&
1917 read(STDIN, $buf, 4);
2018 my $n = hex($buf) - 4;
2119 read(STDIN, $buf, $n);
2220 my ($cmd, $other) = split /\0/, $buf;
2321 # drop absolute-path on repo name
2422 $cmd =~ s{ /}{ };
2523 print $cmd;
26- ')
27- echo >&2 "Running '$cmd'"
28- exec $cmd
29- EOF
30- chmod +x proxy
24+ EOF
25+
26+ write_script proxy <<-\EOF
27+ echo >&2 "proxying for $*"
28+ cmd=$(./proxy-get-cmd)
29+ echo >&2 "Running $cmd"
30+ exec $cmd
31+ EOF
32+ '
33+
3134test_expect_success ' setup local repo' '
3235 git remote add fake git://example.com/remote &&
3336 git config core.gitproxy ./proxy
You can’t perform that action at this time.
0 commit comments