diff options
Diffstat (limited to 't/t2020-checkout-detach.sh')
-rwxr-xr-x | t/t2020-checkout-detach.sh | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/t/t2020-checkout-detach.sh b/t/t2020-checkout-detach.sh index 2eab6474f8..bce284c297 100755 --- a/t/t2020-checkout-detach.sh +++ b/t/t2020-checkout-detach.sh @@ -17,12 +17,12 @@ check_not_detached () { PREV_HEAD_DESC='Previous HEAD position was' check_orphan_warning() { - test_i18ngrep "you are leaving $2 behind" "$1" && - test_i18ngrep ! "$PREV_HEAD_DESC" "$1" + test_grep "you are leaving $2 behind" "$1" && + test_grep ! "$PREV_HEAD_DESC" "$1" } check_no_orphan_warning() { - test_i18ngrep ! "you are leaving .* commit.*behind" "$1" && - test_i18ngrep "$PREV_HEAD_DESC" "$1" + test_grep ! "you are leaving .* commit.*behind" "$1" && + test_grep "$PREV_HEAD_DESC" "$1" } reset () { @@ -45,6 +45,18 @@ test_expect_success 'checkout branch does not detach' ' check_not_detached ' +for opt in "HEAD" "@" +do + test_expect_success "checkout $opt no-op/don't detach" ' + reset && + cat .git/HEAD >expect && + git checkout $opt && + cat .git/HEAD >actual && + check_not_detached && + test_cmp expect actual + ' +done + test_expect_success 'checkout tag detaches' ' reset && git checkout tag && |