Skip to content

Commit

Permalink
checkout: check for "Previous HEAD" notice in t2020
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
René Scharfe authored and Junio C Hamano committed Oct 3, 2011
1 parent f696543 commit 83933c9
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions t/t2020-checkout-detach.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 () {
Expand Down

0 comments on commit 83933c9

Please sign in to comment.