checkout: check for "Previous HEAD" notice in t2020

If we leave a detached head, exactly one of two things happens: either
checkout warns about it being an orphan or describes it as a courtesy.
Test t2020 already checked that the warning is shown as needed.  This
patch also checks for the description.

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
René Scharfe 2011-10-01 17:38:34 +02:00 committed by Junio C Hamano
parent f696543dad
commit 83933c9832

View File

@ -12,11 +12,14 @@ check_not_detached () {
}
ORPHAN_WARNING='you are leaving .* commit.*behind'
PREV_HEAD_DESC='Previous HEAD position was'
check_orphan_warning() {
test_i18ngrep "$ORPHAN_WARNING" "$1"
test_i18ngrep "$ORPHAN_WARNING" "$1" &&
test_i18ngrep ! "$PREV_HEAD_DESC" "$1"
}
check_no_orphan_warning() {
test_i18ngrep ! "$ORPHAN_WARNING" "$1"
test_i18ngrep ! "$ORPHAN_WARNING" "$1" &&
test_i18ngrep "$PREV_HEAD_DESC" "$1"
}
reset () {