Thread (4 messages) flat view 4 messages, 1 author, 2016-06-15
DORMANTno replies

[PATCH 2/3] t2018-checkout-branch.sh: show that checkout -f -b doesn't DWIM

From: Tay Ray Chuan <hidden>
Date: 2016-06-15 22:48:59
Subsystem: the rest · Maintainer: Linus Torvalds

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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help