]> granicus.if.org Git - git/commitdiff
t1430: test for-each-ref in the presence of badly-named refs
authorMichael Haggerty <mhagger@alum.mit.edu>
Thu, 7 Apr 2016 19:02:53 +0000 (15:02 -0400)
committerJunio C Hamano <gitster@pobox.com>
Sun, 10 Apr 2016 18:35:07 +0000 (11:35 -0700)
Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: David Turner <dturner@twopensource.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/t1430-bad-ref-name.sh

index a9639519f0db058c0ffaf9e141286b6f27afeca2..612cc32bfc2bb726822083dba7efc8a3c12c3967 100755 (executable)
@@ -155,6 +155,22 @@ test_expect_success 'rev-parse skips symref pointing to broken name' '
        test_i18ngrep "ignoring dangling symref refs/tags/shadow" err
 '
 
+test_expect_success 'for-each-ref emits warnings for broken names' '
+       cp .git/refs/heads/master .git/refs/heads/broken...ref &&
+       test_when_finished "rm -f .git/refs/heads/broken...ref" &&
+       printf "ref: refs/heads/broken...ref\n" >.git/refs/heads/badname &&
+       test_when_finished "rm -f .git/refs/heads/badname" &&
+       printf "ref: refs/heads/master\n" >.git/refs/heads/broken...symref &&
+       test_when_finished "rm -f .git/refs/heads/broken...symref" &&
+       git for-each-ref >output 2>error &&
+       ! grep -e "broken\.\.\.ref" output &&
+       ! grep -e "badname" output &&
+       ! grep -e "broken\.\.\.symref" output &&
+       test_i18ngrep "ignoring ref with broken name refs/heads/broken\.\.\.ref" error &&
+       test_i18ngrep "ignoring broken ref refs/heads/badname" error &&
+       test_i18ngrep "ignoring ref with broken name refs/heads/broken\.\.\.symref" error
+'
+
 test_expect_success 'update-ref --no-deref -d can delete reference to broken name' '
        printf "ref: refs/heads/broken...ref\n" >.git/refs/heads/badname &&
        test_when_finished "rm -f .git/refs/heads/badname" &&