3 test_description
='fetching via git:// using core.gitproxy'
5 TEST_PASSES_SANITIZE_LEAK
=true
8 test_expect_success
'setup remote repo' '
17 test_expect_success
'setup proxy script' '
18 write_script proxy-get-cmd "$PERL_PATH" <<-\EOF &&
20 my $n = hex($buf) - 4;
21 read(STDIN, $buf, $n);
22 my ($cmd, $other) = split /\0/, $buf;
23 # drop absolute-path on repo name
28 write_script proxy <<-\EOF
29 echo >&2 "proxying for $*"
30 cmd=$(./proxy-get-cmd)
31 echo >&2 "Running $cmd"
36 test_expect_success
'setup local repo' '
37 git remote add fake git://example.com/remote &&
38 git config core.gitproxy ./proxy
41 test_expect_success
'fetch through proxy works' '
44 git log -1 --format=%s FETCH_HEAD >actual &&
45 test_cmp expect actual
48 test_expect_success
'funny hostnames are rejected before running proxy' '
49 test_must_fail git fetch git://-remote/repo.git 2>stderr &&
50 ! grep "proxying for" stderr