Browse Source

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>
maint
Michael Haggerty 9 years ago committed by Junio C Hamano
parent
commit
b78ceced0c
  1. 16
      t/t1430-bad-ref-name.sh

16
t/t1430-bad-ref-name.sh

@ -155,6 +155,22 @@ test_expect_success 'rev-parse skips symref pointing to broken name' ' @@ -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" &&

Loading…
Cancel
Save