Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbrian m. carlson <sandals@crustytoothpaste.net>2020-05-21 05:07:12 +0300
committerJunio C Hamano <gitster@pobox.com>2020-05-21 19:55:23 +0300
commit8d3e33dadd359495e43cb65dfadd775987e3da26 (patch)
tree2a88497de52a223fde0197a3397021a811c210ad /t/t2060-switch.sh
parent81861288a987c6e05526526fa5dc74d2e2b80a5a (diff)
t2060: add a test for switch with --orphan and --discard-changes
We have several code paths in the checkout code which are traversed only in this case, due to switch having different defaults from checkout. Let's add a test that the combination of options works and produces the expected behavior. Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Reviewed-by: Derrick Stolee <dstolee@microsoft.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
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 &&