mirror of
https://github.com/git-for-windows/git.git
synced 2026-02-03 18:59:59 -06:00
While it may seem super convenient to some old Unix hands to simpy require Perl to be available when running the test suite, this is a major hassle on Windows, where we want to verify that Perl is not, actually, required in a NO_PERL build. As a super ugly workaround, we "install" a script into /usr/bin/perl reading like this: #!/bin/sh # We'd much rather avoid requiring Perl altogether when testing # an installed Git. Oh well, that's why we cannot have nice # things. exec c:/git-sdk-64/usr/bin/perl.exe "$@" The problem with that is that BusyBox assumes that the #! line in a script refers to an executable, not to a script. So when it encounters the line #!/usr/bin/perl in t5532's proxy-get-cmd, it barfs. Let's help this situation by simply executing the Perl script with the "interpreter" specified explicitly. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
59 lines
1.2 KiB
Bash
Executable File
59 lines
1.2 KiB
Bash
Executable File
#!/bin/sh
|
|
|
|
test_description='fetching via git:// using core.gitproxy'
|
|
|
|
. ./test-lib.sh
|
|
|
|
if ! test_have_prereq PERL_TEST_HELPERS
|
|
then
|
|
skip_all='skipping fetch proxy tests; Perl not available'
|
|
test_done
|
|
fi
|
|
|
|
test_expect_success 'setup remote repo' '
|
|
git init remote &&
|
|
(cd remote &&
|
|
echo content >file &&
|
|
git add file &&
|
|
git commit -m one
|
|
)
|
|
'
|
|
|
|
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);
|
|
my ($cmd, $other) = split /\0/, $buf;
|
|
# drop absolute-path on repo name
|
|
$cmd =~ s{ /}{ };
|
|
print $cmd;
|
|
EOF
|
|
|
|
write_script proxy <<-\EOF
|
|
echo >&2 "proxying for $*"
|
|
cmd=$("$PERL_PATH" ./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
|
|
'
|
|
|
|
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_expect_success 'funny hostnames are rejected before running proxy' '
|
|
test_must_fail git fetch git://-remote/repo.git 2>stderr &&
|
|
! grep "proxying for" stderr
|
|
'
|
|
|
|
test_done
|