Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/git/blob/master/t/t5532-fetch-proxy.sh # git [Ported from github.com/git/git] Sync with Git 2.56.1 Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `master` Branches Tags History `git / t / t5532-fetch-proxy.sh` 58 lines ยท 1227 bytes Raw Blame History 1 #!/bin/sh 2 3 test_description='fetching via git:// using core.gitproxy' 4 5 . ./test-lib.sh 6 7 if ! test_have_prereq PERL_TEST_HELPERS 8 then 9 skip_all='skipping fetch proxy tests; Perl not available' 10 test_done 11 fi 12 13 test_expect_success 'setup remote repo' ' 14 git init remote && 15 (cd remote && 16 echo content >file && 17 git add file && 18 git commit -m one 19 ) 20 ' 21 22 test_expect_success 'setup proxy script' ' 23 write_script proxy-get-cmd "$PERL_PATH" <<-\EOF && 24 read(STDIN, $buf, 4); 25 my $n = hex($buf) - 4; 26 read(STDIN, $buf, $n); 27 my ($cmd, $other) = split /\0/, $buf; 28 # drop absolute-path on repo name 29 $cmd =~ s{ /}{ }; 30 print $cmd; 31 EOF 32 33 write_script proxy <<-\EOF 34 echo >&2 "proxying for $*" 35 cmd=$(./proxy-get-cmd) 36 echo >&2 "Running $cmd" 37 exec $cmd 38 EOF 39 ' 40 41 test_expect_success 'setup local repo' ' 42 git remote add fake git://example.com/remote && 43 git config core.gitproxy ./proxy 44 ' 45 46 test_expect_success 'fetch through proxy works' ' 47 git fetch fake && 48 echo one >expect && 49 git log -1 --format=%s FETCH_HEAD >actual && 50 test_cmp expect actual 51 ' 52 53 test_expect_success 'funny hostnames are rejected before running proxy' ' 54 test_must_fail git fetch git://-remote/repo.git 2>stderr && 55 test_grep ! "proxying for" stderr 56 ' 57 58 test_done