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' '
141
141
test_expect_success ' GIT_PREFIX for built-ins' '
142
142
# Use GIT_EXTERNAL_DIFF to test that the "diff" built-in
143
143
# 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
148
148
(
149
149
cd dir &&
150
- printf "change" >two &&
150
+ echo "change" >two &&
151
151
GIT_EXTERNAL_DIFF=./diff git diff >../actual
152
152
git checkout -- two
153
153
) &&
Original file line number Diff line number Diff line change @@ -555,10 +555,9 @@ test_expect_success 'rebase a detached HEAD' '
555
555
test_expect_success ' rebase a commit violating pre-commit' '
556
556
557
557
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
562
561
echo "monde! " >> file1 &&
563
562
test_tick &&
564
563
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' '
12
12
)
13
13
'
14
14
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 &&
19
17
read(STDIN, $buf, 4);
20
18
my $n = hex($buf) - 4;
21
19
read(STDIN, $buf, $n);
22
20
my ($cmd, $other) = split /\0/, $buf;
23
21
# drop absolute-path on repo name
24
22
$cmd =~ s{ /}{ };
25
23
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
+
31
34
test_expect_success ' setup local repo' '
32
35
git remote add fake git://example.com/remote &&
33
36
git config core.gitproxy ./proxy
You can’t perform that action at this time.
0 commit comments