checkout: check for "Previous HEAD" notice in t2020
authorRené Scharfe <rene.scharfe@lsrfire.ath.cx>
Sat, 1 Oct 2011 15:38:34 +0000 (17:38 +0200)
committerJunio C Hamano <gitster@pobox.com>
Mon, 3 Oct 2011 18:02:25 +0000 (11:02 -0700)
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>
t/t2020-checkout-detach.sh

index 2366f0f4141656666db9cdcd8975335df57b6a8f..068fba4c8e8706aa615d0401da1da47901113156 100755 (executable)
@@ -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 () {