git/t/t5532-fetch-proxy.sh
Vincent van Ravesteijn a3428205e6 t: Replace 'perl' by $PERL_PATH
GIT-BUILD-OPTIONS defines PERL_PATH to be used in the test suite. Only a
few tests already actually use this variable when perl is needed. The
other test just call 'perl' and it might happen that the wrong perl
interpreter is used.

This becomes problematic on Windows, when the perl interpreter that is
compiled and installed on the Windows system is used, because this perl
interpreter might introduce some unexpected LF->CRLF conversions.

This patch makes sure that $PERL_PATH is used everywhere in the test suite
and that the correct perl interpreter is used.

Signed-off-by: Vincent van Ravesteijn <vfr@lyx.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-06-12 09:30:41 -07:00

44 lines
844 B
Bash
Executable file

#!/bin/sh
test_description='fetching via git:// using core.gitproxy'
. ./test-lib.sh
test_expect_success 'setup remote repo' '
git init remote &&
(cd remote &&
echo content >file &&
git add file &&
git commit -m one
)
'
cat >proxy <<'EOF'
#!/bin/sh
echo >&2 "proxying for $*"
cmd=`$PERL_PATH -e '
read(STDIN, $buf, 4);
my $n = hex($buf) - 4;
read(STDIN, $buf, $n);
my ($cmd, $other) = split /\0/, $buf;
# drop absolute-path on repo name
$cmd =~ s{ /}{ };
print $cmd;
'`
echo >&2 "Running '$cmd'"
exec $cmd
EOF
chmod +x proxy
test_expect_success 'setup local repo' '
git remote add fake git://example.com/remote &&
git config core.gitproxy ./proxy
'
test_expect_success 'fetch through proxy works' '
git fetch fake &&
echo one >expect &&
git log -1 --format=%s FETCH_HEAD >actual &&
test_cmp expect actual
'
test_done