diff options
author | Nguyễn Thái Ngọc Duy <pclouds@gmail.com> | 2016-09-07 18:19:41 +0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2016-09-21 08:44:41 -0700 |
commit | b829b9439adc12fa4fb33338694e7f1ad40254c1 (patch) | |
tree | b7718c1f6996471f382dd5d8b02c95ab303e37bb /t/t2024-checkout-dwim.sh | |
parent | 19e5656345cb308ab689932d64af0858a3a92400 (diff) | |
download | git-b829b9439adc12fa4fb33338694e7f1ad40254c1.tar.gz git-b829b9439adc12fa4fb33338694e7f1ad40254c1.tar.xz |
checkout: fix ambiguity check in subdir
The two functions in parse_branchname_arg(), verify_non_filename and
check_filename, need correct prefix in order to reconstruct the paths
and check for their existence. With NULL prefix, they just check paths
at top dir instead.
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t2024-checkout-dwim.sh')
-rwxr-xr-x | t/t2024-checkout-dwim.sh | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/t/t2024-checkout-dwim.sh b/t/t2024-checkout-dwim.sh index 468a000e4..3e5ac81bd 100755 --- a/t/t2024-checkout-dwim.sh +++ b/t/t2024-checkout-dwim.sh @@ -174,6 +174,18 @@ test_expect_success 'checkout of branch with a file having the same name fails' test_branch master ' +test_expect_success 'checkout of branch with a file in subdir having the same name fails' ' + git checkout -B master && + test_might_fail git branch -D spam && + + >spam && + mkdir sub && + mv spam sub/spam && + test_must_fail git -C sub checkout spam && + test_must_fail git rev-parse --verify refs/heads/spam && + test_branch master +' + test_expect_success 'checkout <branch> -- succeeds, even if a file with the same name exists' ' git checkout -B master && test_might_fail git branch -D spam && |