3 test_description
='fetching via git:// using core.gitproxy'
6 test_expect_success
'setup remote repo' '
15 test_expect_success
'setup proxy script' '
16 write_script proxy-get-cmd "$PERL_PATH" <<-\EOF &&
18 my $n = hex($buf) - 4;
19 read(STDIN, $buf, $n);
20 my ($cmd, $other) = split /\0/, $buf;
21 # drop absolute-path on repo name
26 write_script proxy <<-\EOF
27 echo >&2 "proxying for $*"
28 cmd=$(./proxy-get-cmd)
29 echo >&2 "Running $cmd"
34 test_expect_success
'setup local repo' '
35 git remote add fake git://example.com/remote &&
36 git config core.gitproxy ./proxy
39 test_expect_success
'fetch through proxy works' '
42 git log -1 --format=%s FETCH_HEAD >actual &&
43 test_cmp expect actual
46 test_expect_success
'funny hostnames are rejected before running proxy' '
47 test_must_fail git fetch git://-remote/repo.git 2>stderr &&
48 ! grep "proxying for" stderr