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>
René Scharfe committed
Oct 1, 2011 at 17:38 UTC
83933c9832af91a71337e429a6251f1a3b6d6f60
1 file changed
+5
-2
t/t2020-checkout-detach.sh
+5
-2
@@ -12,11 +12,14 @@ check_not_detached () {
12
}
13
14
ORPHAN_WARNING='you are leaving .* commit.*behind'
15
+PREV_HEAD_DESC='Previous HEAD position was'
16
check_orphan_warning() {
16
- test_i18ngrep "$ORPHAN_WARNING" "$1"
17
+ test_i18ngrep "$ORPHAN_WARNING" "$1" &&
18
+ test_i18ngrep ! "$PREV_HEAD_DESC" "$1"
19
}
20
check_no_orphan_warning() {
19
- test_i18ngrep ! "$ORPHAN_WARNING" "$1"
21
+ test_i18ngrep ! "$ORPHAN_WARNING" "$1" &&
22
+ test_i18ngrep "$PREV_HEAD_DESC" "$1"
23
}
24
25
reset () {