diff options
author | Junio C Hamano <gitster@pobox.com> | 2012-04-24 14:40:51 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2012-04-24 14:40:51 -0700 |
commit | 77cab8af4ad6c25995e40a5ababc7a17dc369fe0 (patch) | |
tree | 5658750a7e8772b77d73f0a115c2cd55fdbb8f7a /t | |
parent | Merge branch 'pw/fast-import-dataref-parsing' (diff) | |
parent | remote-curl: main test case for the OS command line overflow (diff) | |
download | tgif-77cab8af4ad6c25995e40a5ababc7a17dc369fe0.tar.xz |
Merge branch 'it/fetch-pack-many-refs'
When "git fetch" encounters repositories with too many references, the
command line of "fetch-pack" that is run by a helper e.g. remote-curl,
may fail to hold all of them. Now such an internal invocation can feed
the references through the standard input of "fetch-pack".
By Ivan Todoroski
* it/fetch-pack-many-refs:
remote-curl: main test case for the OS command line overflow
fetch-pack: test cases for the new --stdin option
remote-curl: send the refs to fetch-pack on stdin
fetch-pack: new --stdin option to read refs from stdin
Diffstat (limited to 't')
-rwxr-xr-x | t/t5500-fetch-pack.sh | 66 | ||||
-rwxr-xr-x | t/t5551-http-fetch.sh | 31 |
2 files changed, 97 insertions, 0 deletions
diff --git a/t/t5500-fetch-pack.sh b/t/t5500-fetch-pack.sh index ce51692bb2..1d1ca98588 100755 --- a/t/t5500-fetch-pack.sh +++ b/t/t5500-fetch-pack.sh @@ -326,4 +326,70 @@ EOF test_cmp count7.expected count7.actual ' +test_expect_success 'setup tests for the --stdin parameter' ' + for head in C D E F + do + add $head + done && + for head in A B C D E F + do + git tag $head $head + done && + cat >input <<-\EOF + refs/heads/C + refs/heads/A + refs/heads/D + refs/tags/C + refs/heads/B + refs/tags/A + refs/heads/E + refs/tags/B + refs/tags/E + refs/tags/D + EOF + sort <input >expect && + ( + echo refs/heads/E && + echo refs/tags/E && + cat input + ) >input.dup +' + +test_expect_success 'fetch refs from cmdline' ' + ( + cd client && + git fetch-pack --no-progress .. $(cat ../input) + ) >output && + cut -d " " -f 2 <output | sort >actual && + test_cmp expect actual +' + +test_expect_success 'fetch refs from stdin' ' + ( + cd client && + git fetch-pack --stdin --no-progress .. <../input + ) >output && + cut -d " " -f 2 <output | sort >actual && + test_cmp expect actual +' + +test_expect_success 'fetch mixed refs from cmdline and stdin' ' + ( + cd client && + tail -n +5 ../input | + git fetch-pack --stdin --no-progress .. $(head -n 4 ../input) + ) >output && + cut -d " " -f 2 <output | sort >actual && + test_cmp expect actual +' + +test_expect_success 'test duplicate refs from stdin' ' + ( + cd client && + test_must_fail git fetch-pack --stdin --no-progress .. <../input.dup + ) >output && + cut -d " " -f 2 <output | sort >actual && + test_cmp expect actual +' + test_done diff --git a/t/t5551-http-fetch.sh b/t/t5551-http-fetch.sh index 26d355725f..be6094be77 100755 --- a/t/t5551-http-fetch.sh +++ b/t/t5551-http-fetch.sh @@ -109,5 +109,36 @@ test_expect_success 'follow redirects (302)' ' git clone $HTTPD_URL/smart-redir-temp/repo.git --quiet repo-t ' +test -n "$GIT_TEST_LONG" && test_set_prereq EXPENSIVE + +test_expect_success EXPENSIVE 'create 50,000 tags in the repo' ' + ( + cd "$HTTPD_DOCUMENT_ROOT_PATH/repo.git" && + for i in `seq 50000` + do + echo "commit refs/heads/too-many-refs" + echo "mark :$i" + echo "committer git <git@example.com> $i +0000" + echo "data 0" + echo "M 644 inline bla.txt" + echo "data 4" + echo "bla" + # make every commit dangling by always + # rewinding the branch after each commit + echo "reset refs/heads/too-many-refs" + echo "from :1" + done | git fast-import --export-marks=marks && + + # now assign tags to all the dangling commits we created above + tag=$(perl -e "print \"bla\" x 30") && + sed -e "s/^:\(.\+\) \(.\+\)$/\2 refs\/tags\/$tag-\1/" <marks >>packed-refs + ) +' + +test_expect_success EXPENSIVE 'clone the 50,000 tag repo to check OS command line overflow' ' + git clone $HTTPD_URL/smart/repo.git too-many-refs 2>err && + test_line_count = 0 err +' + stop_httpd test_done |