aboutsummaryrefslogtreecommitdiff
path: root/t/t2010-checkout-ambiguous.sh
diff options
context:
space:
mode:
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>2016-09-07 18:19:41 +0700
committerJunio C Hamano <gitster@pobox.com>2016-09-21 08:44:41 -0700
commitb829b9439adc12fa4fb33338694e7f1ad40254c1 (patch)
treeb7718c1f6996471f382dd5d8b02c95ab303e37bb /t/t2010-checkout-ambiguous.sh
parent19e5656345cb308ab689932d64af0858a3a92400 (diff)
downloadgit-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/t2010-checkout-ambiguous.sh')
-rwxr-xr-xt/t2010-checkout-ambiguous.sh9
1 files changed, 9 insertions, 0 deletions
diff --git a/t/t2010-checkout-ambiguous.sh b/t/t2010-checkout-ambiguous.sh
index e76e84afb..2e47fe01c 100755
--- a/t/t2010-checkout-ambiguous.sh
+++ b/t/t2010-checkout-ambiguous.sh
@@ -41,6 +41,15 @@ test_expect_success 'check ambiguity' '
test_must_fail git checkout world all
'
+test_expect_success 'check ambiguity in subdir' '
+ mkdir sub &&
+ # not ambiguous because sub/world does not exist
+ git -C sub checkout world ../all &&
+ echo hello >sub/world &&
+ # ambiguous because sub/world does exist
+ test_must_fail git -C sub checkout world ../all
+'
+
test_expect_success 'disambiguate checking out from a tree-ish' '
echo bye > world &&
git checkout world -- world &&