Merge branch 'nd/branch-show-rebase-bisect-state'
[git/jnareb-git.git] / t / t5532-fetch-proxy.sh
blob5531bd1af42dac808d64d75a6fc3e848ef968a34
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 cat >proxy <<'EOF'
16 #!/bin/sh
17 echo >&2 "proxying for $*"
18 cmd=`"$PERL_PATH" -e '
19 read(STDIN, $buf, 4);
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
24 $cmd =~ s{ /}{ };
25 print $cmd;
27 echo >&2 "Running '$cmd'"
28 exec $cmd
29 EOF
30 chmod +x proxy
31 test_expect_success 'setup local repo' '
32 git remote add fake git://example.com/remote &&
33 git config core.gitproxy ./proxy
36 test_expect_success 'fetch through proxy works' '
37 git fetch fake &&
38 echo one >expect &&
39 git log -1 --format=%s FETCH_HEAD >actual &&
40 test_cmp expect actual
43 test_done