summaryrefslogtreecommitdiff
path: root/t/t5500-fetch-pack.sh
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2012-05-02 04:12:36 (GMT)
committerJunio C Hamano <gitster@pobox.com>2012-05-02 04:12:36 (GMT)
commitcda03b6ad3e685ebf8349597afd71553a3ebb3a4 (patch)
tree7a8192c935d2672551d58302b17985814ce7ce5d /t/t5500-fetch-pack.sh
parent17f695b479546c691f797a5f1d153fbb3010fb2f (diff)
parent7103d2543ad138bd9df672cdc94cc070dd7417d8 (diff)
downloadgit-cda03b6ad3e685ebf8349597afd71553a3ebb3a4.zip
git-cda03b6ad3e685ebf8349597afd71553a3ebb3a4.tar.gz
git-cda03b6ad3e685ebf8349597afd71553a3ebb3a4.tar.bz2
Merge branch 'it/fetch-pack-many-refs' into maint
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 Conflicts: t/t5500-fetch-pack.sh
Diffstat (limited to 't/t5500-fetch-pack.sh')
-rwxr-xr-xt/t5500-fetch-pack.sh66
1 files changed, 66 insertions, 0 deletions
diff --git a/t/t5500-fetch-pack.sh b/t/t5500-fetch-pack.sh
index ce51692..1d1ca98 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