mirror of
https://github.com/git/git
synced 2024-08-24 18:26:02 +00:00
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 <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
d95553a6b8
commit
ca386ee177
|
@ -12,10 +12,8 @@ test_expect_success 'setup remote repo' '
|
|||
)
|
||||
'
|
||||
|
||||
cat >proxy <<'EOF'
|
||||
#!/bin/sh
|
||||
echo >&2 "proxying for $*"
|
||||
cmd=$("$PERL_PATH" -e '
|
||||
test_expect_success 'setup proxy script' '
|
||||
write_script proxy-get-cmd "$PERL_PATH" <<-\EOF &&
|
||||
read(STDIN, $buf, 4);
|
||||
my $n = hex($buf) - 4;
|
||||
read(STDIN, $buf, $n);
|
||||
|
@ -23,11 +21,16 @@ cmd=$("$PERL_PATH" -e '
|
|||
# drop absolute-path on repo name
|
||||
$cmd =~ s{ /}{ };
|
||||
print $cmd;
|
||||
')
|
||||
echo >&2 "Running '$cmd'"
|
||||
exec $cmd
|
||||
EOF
|
||||
chmod +x proxy
|
||||
EOF
|
||||
|
||||
write_script proxy <<-\EOF
|
||||
echo >&2 "proxying for $*"
|
||||
cmd=$(./proxy-get-cmd)
|
||||
echo >&2 "Running $cmd"
|
||||
exec $cmd
|
||||
EOF
|
||||
'
|
||||
|
||||
test_expect_success 'setup local repo' '
|
||||
git remote add fake git://example.com/remote &&
|
||||
git config core.gitproxy ./proxy
|
||||
|
|
Loading…
Reference in a new issue