summaryrefslogtreecommitdiff
path: root/t/t2060-switch.sh
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2020-06-08 18:06:30 -0700
committerLibravatar Junio C Hamano <gitster@pobox.com>2020-06-08 18:06:30 -0700
commitded44afa023c981d803b56f42284ed0597a174ee (patch)
treec8ae180f8155772f3d476598564cd901cc2a9e61 /t/t2060-switch.sh
parentMerge branch 'vs/complete-stash-show-p-fix' (diff)
parentt2060: add a test for switch with --orphan and --discard-changes (diff)
downloadtgif-ded44afa023c981d803b56f42284ed0597a174ee.tar.xz
Merge branch 'bc/filter-process'
Code simplification and test coverage enhancement. * bc/filter-process: t2060: add a test for switch with --orphan and --discard-changes builtin/checkout: simplify metadata initialization
Diffstat (limited to 't/t2060-switch.sh')
-rwxr-xr-xt/t2060-switch.sh8
1 files changed, 8 insertions, 0 deletions
diff --git a/t/t2060-switch.sh b/t/t2060-switch.sh
index f9efa29dfb..2c1b8c0d6d 100755
--- a/t/t2060-switch.sh
+++ b/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 &&