about summary refs log tree commit diff
path: root/third_party/git/t/t2060-switch.sh
diff options
context:
space:
mode:
Diffstat (limited to 'third_party/git/t/t2060-switch.sh')
-rwxr-xr-xthird_party/git/t/t2060-switch.sh8
1 files changed, 8 insertions, 0 deletions
diff --git a/third_party/git/t/t2060-switch.sh b/third_party/git/t/t2060-switch.sh
index f9efa29dfb8c..2c1b8c0d6d22 100755
--- a/third_party/git/t/t2060-switch.sh
+++ b/third_party/git/t/t2060-switch.sh
@@ -68,6 +68,14 @@ test_expect_success 'new orphan branch from empty' '
 	test_cmp expected tracked-files
 '
 
+test_expect_success 'orphan branch works with --discard-changes' '
+	test_when_finished git switch master &&
+	echo foo >foo.txt &&
+	git switch --discard-changes --orphan new-orphan2 &&
+	git ls-files >tracked-files &&
+	test_must_be_empty tracked-files
+'
+
 test_expect_success 'switching ignores file of same branch name' '
 	test_when_finished git switch master &&
 	: >first-branch &&