fetch-pack: eliminate spurious error messages
[gitweb.git] / t / t5500-fetch-pack.sh
index e80a2af348565a0a3d001ef28cb76427acfee495..6322e8ade8436dc4e66b9874638e7ca6b7d222b3 100755 (executable)
@@ -391,10 +391,55 @@ test_expect_success 'fetch mixed refs from cmdline and stdin' '
 test_expect_success 'test duplicate refs from stdin' '
        (
        cd client &&
-       test_must_fail git fetch-pack --stdin --no-progress .. <../input.dup
+       git fetch-pack --stdin --no-progress .. <../input.dup
        ) >output &&
        cut -d " " -f 2 <output | sort >actual &&
        test_cmp expect actual
 '
 
+test_expect_success 'set up tests of missing reference' '
+       cat >expect-error <<-\EOF
+       error: no such remote ref refs/heads/xyzzy
+       EOF
+'
+
+test_expect_success 'test lonely missing ref' '
+       (
+               cd client &&
+               test_must_fail git fetch-pack --no-progress .. refs/heads/xyzzy
+       ) >/dev/null 2>error-m &&
+       test_cmp expect-error error-m
+'
+
+test_expect_success 'test missing ref after existing' '
+       (
+               cd client &&
+               test_must_fail git fetch-pack --no-progress .. refs/heads/A refs/heads/xyzzy
+       ) >/dev/null 2>error-em &&
+       test_cmp expect-error error-em
+'
+
+test_expect_success 'test missing ref before existing' '
+       (
+               cd client &&
+               test_must_fail git fetch-pack --no-progress .. refs/heads/xyzzy refs/heads/A
+       ) >/dev/null 2>error-me &&
+       test_cmp expect-error error-me
+'
+
+test_expect_success 'test --all, --depth, and explicit head' '
+       (
+               cd client &&
+               git fetch-pack --no-progress --all --depth=1 .. refs/heads/A
+       ) >out-adh 2>error-adh
+'
+
+test_expect_success 'test --all, --depth, and explicit tag' '
+       git tag OLDTAG refs/heads/B~5 &&
+       (
+               cd client &&
+               git fetch-pack --no-progress --all --depth=1 .. refs/tags/OLDTAG
+       ) >out-adt 2>error-adt
+'
+
 test_done