From: Tay Ray Chuan Date: Sun, 20 Jun 2010 16:33:11 GMT Subject: [PATCH 2/3] t2018-checkout-branch.sh: show that checkout -f -b doesn't DWIM Message-ID: <1277051592-4552-3-git-send-email-rctay89@gmail.com> In-Reply-To: <1277051592-4552-2-git-send-email-rctay89@gmail.com> Signed-off-by: Tay Ray Chuan --- t/t2018-checkout-branch.sh | 20 ++++++++++++++++++++ 1 files changed, 20 insertions(+), 0 deletions(-) diff --git a/t/t2018-checkout-branch.sh b/t/t2018-checkout-branch.sh index 678a34f..e6c0f8c 100755 --- a/t/t2018-checkout-branch.sh +++ b/t/t2018-checkout-branch.sh @@ -63,4 +63,24 @@ test_expect_success 'checkout -b to an existing branch fails' ' test_must_fail do_checkout branch2 $HEAD2 ' +test_expect_failure 'checkout -f -b to an existing branch resets branch' ' + git checkout branch1 && + + do_checkout branch2 "" -f +' + +test_expect_failure 'checkout -f -b to an existing branch resets branch (explicit ref)' ' + git checkout branch1 && + + do_checkout branch2 $HEAD1 -f +' + +test_expect_failure 'checkout -f -b to an existing branch resets branch (dirty) ' ' + git checkout branch1 && + + setup_dirty && + do_checkout branch2 $HEAD1 -f && + test_must_fail test_dirty +' + test_done -- 1.7.1.513.g4f18