Skip to content

Commit ca386ee

Browse files
peffgitster
authored andcommitted
t5532: use write_script
The recent cleanup in b7cbbff switched t5532's use of backticks to $(). This matches our normal shell style, which is good. But it also breaks the test on Solaris, where /bin/sh does not understand $(). Our normal shell style assumes a modern-ish shell which knows about $(). However, some tests create small helper scripts and just write "#!/bin/sh" into them. These scripts either need to go back to using backticks, or they need to respect $SHELL_PATH. The easiest way to do the latter is to use write_script. While we're at it, let's also stick the script creation inside a test_expect block (our usual style), and split the perl snippet into its own script (to prevent quoting madness). Signed-off-by: Jeff King <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent d95553a commit ca386ee

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

t/t5532-fetch-proxy.sh

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff 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+
3134
test_expect_success 'setup local repo' '
3235
git remote add fake git://example.com/remote &&
3336
git config core.gitproxy ./proxy

0 commit comments

Comments
 (0)