Signed-off-by: Tay Ray Chuan <redacted>
---
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