summaryrefslogtreecommitdiff
path: root/t/t1430-bad-ref-name.sh
diff options
context:
space:
mode:
authorMichael Haggerty <mhagger@alum.mit.edu>2016-04-07 15:02:53 -0400
committerJunio C Hamano <gitster@pobox.com>2016-04-10 11:35:07 -0700
commitb78ceced0ce0a8c098fad9d979b47ea98e27d22a (patch)
treeb5cc99f1836c9e922a7a1199cf79b36ce327ef8e /t/t1430-bad-ref-name.sh
parent6141a6dcdce6b925b3670a995ffc59e78658521b (diff)
downloadgit-b78ceced0ce0a8c098fad9d979b47ea98e27d22a.tar.gz
t1430: test for-each-ref in the presence of badly-named refs
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>
Diffstat (limited to 't/t1430-bad-ref-name.sh')
-rwxr-xr-xt/t1430-bad-ref-name.sh16
1 files changed, 16 insertions, 0 deletions
diff --git a/t/t1430-bad-ref-name.sh b/t/t1430-bad-ref-name.sh
index a9639519f0..612cc32bfc 100755
--- a/t/t1430-bad-ref-name.sh
+++ b/t/t1430-bad-ref-name.sh
@@ -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" &&