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>
This commit is contained in:
Michael Haggerty 2016-04-07 15:02:53 -04:00 коммит произвёл Junio C Hamano
Родитель 6141a6dcdc
Коммит b78ceced0c
1 изменённых файлов: 16 добавлений и 0 удалений

Просмотреть файл

@ -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" &&