Skip to content

Commit 83933c9

Browse files
René Scharfegitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent f696543 commit 83933c9

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

t/t2020-checkout-detach.sh

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,14 @@ check_not_detached () {
1212
}
1313

1414
ORPHAN_WARNING='you are leaving .* commit.*behind'
15+
PREV_HEAD_DESC='Previous HEAD position was'
1516
check_orphan_warning() {
16-
test_i18ngrep "$ORPHAN_WARNING" "$1"
17+
test_i18ngrep "$ORPHAN_WARNING" "$1" &&
18+
test_i18ngrep ! "$PREV_HEAD_DESC" "$1"
1719
}
1820
check_no_orphan_warning() {
19-
test_i18ngrep ! "$ORPHAN_WARNING" "$1"
21+
test_i18ngrep ! "$ORPHAN_WARNING" "$1" &&
22+
test_i18ngrep "$PREV_HEAD_DESC" "$1"
2023
}
2124

2225
reset () {

0 commit comments

Comments
 (0)