t5500: add tests of error output for missing refs
authorMichael Haggerty <mhagger@alum.mit.edu>
Sun, 9 Sep 2012 06:19:36 +0000 (08:19 +0200)
committerJunio C Hamano <gitster@pobox.com>
Wed, 12 Sep 2012 18:46:31 +0000 (11:46 -0700)
If "git fetch-pack" is called with reference names that do not exist
on the remote, then it should emit an error message

    error: no such remote ref refs/heads/xyzzy

This is currently broken if *only* missing references are passed to
"git fetch-pack".

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/t5500-fetch-pack.sh

index e80a2af348565a0a3d001ef28cb76427acfee495..6fa1ceffee99c786beb2d9e6a3d8ec268ccc2337 100755 (executable)
@@ -397,4 +397,34 @@ test_expect_success 'test duplicate refs from stdin' '
        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_failure '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_done