trailer: make args have their own struct
[git/raj.git] / t / t5532-fetch-proxy.sh
blob51c9669398a01bab0b59174ec6ec1be92c3f21fe
1 #!/bin/sh
3 test_description='fetching via git:// using core.gitproxy'
4 . ./test-lib.sh
6 test_expect_success 'setup remote repo' '
7 git init remote &&
8 (cd remote &&
9 echo content >file &&
10 git add file &&
11 git commit -m one
15 test_expect_success 'setup proxy script' '
16 write_script proxy-get-cmd "$PERL_PATH" <<-\EOF &&
17 read(STDIN, $buf, 4);
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
22 $cmd =~ s{ /}{ };
23 print $cmd;
24 EOF
26 write_script proxy <<-\EOF
27 echo >&2 "proxying for $*"
28 cmd=$(./proxy-get-cmd)
29 echo >&2 "Running $cmd"
30 exec $cmd
31 EOF
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' '
40 git fetch fake &&
41 echo one >expect &&
42 git log -1 --format=%s FETCH_HEAD >actual &&
43 test_cmp expect actual
46 test_done