Merge branch 'jk/maint-commit-check-committer-early' into maint-1.7.11
[gitweb.git] / t / t5500-fetch-pack.sh
index ce51692bb2b9ae221d11458a01ab8ef669f24659..e80a2af348565a0a3d001ef28cb76427acfee495 100755 (executable)
@@ -125,6 +125,11 @@ test_expect_success 'single branch object count' '
        test_cmp expected count.singlebranch
 '
 
+test_expect_success 'single given branch clone' '
+       git clone --single-branch --branch A "file://$(pwd)/." branch-a &&
+       test_must_fail git --git-dir=branch-a/.git rev-parse origin/B
+'
+
 test_expect_success 'clone shallow' '
        git clone --no-single-branch --depth 2 "file://$(pwd)/." shallow
 '
@@ -276,7 +281,7 @@ test_expect_success 'clone shallow with --branch' '
 '
 
 test_expect_success 'clone shallow object count' '
-       echo "in-pack: 12" > count3.expected &&
+       echo "in-pack: 6" > count3.expected &&
        GIT_DIR=shallow3/.git git count-objects -v |
                grep "^in-pack" > count3.actual &&
        test_cmp count3.expected count3.actual
@@ -326,4 +331,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