diff options
author | Junio C Hamano <gitster@pobox.com> | 2013-11-07 14:36:59 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2013-11-07 14:36:59 -0800 |
commit | 07c55c00a56ced7dac32206dbaebbb06bf129a37 (patch) | |
tree | d50cd317fa00f1e93dc74cf1503df92861f50f80 /t | |
parent | 9ad3f74cb6fe840b3bbf8d279443dc09c98400a5 (diff) | |
parent | bca39695343ecb113b30c72a3b2e0cb7e73757d8 (diff) | |
download | git-07c55c00a56ced7dac32206dbaebbb06bf129a37.tar.gz git-07c55c00a56ced7dac32206dbaebbb06bf129a37.tar.xz |
Merge branch 'mm/checkout-auto-track-fix' into maint
"git checkout topic", when there is not yet a local "topic" branch
but there is a unique remote-tracking branch for a remote "topic"
branch, pretended as if "git checkout -t -b topic remote/$r/topic"
(for that unique remote $r) was run. This hack however was not
implemented for "git checkout topic --".
* mm/checkout-auto-track-fix:
checkout: proper error message on 'git checkout foo bar --'
checkout: allow dwim for branch creation for "git checkout $branch --"
Diffstat (limited to 't')
-rwxr-xr-x | t/t2010-checkout-ambiguous.sh | 6 | ||||
-rwxr-xr-x | t/t2024-checkout-dwim.sh | 21 |
2 files changed, 27 insertions, 0 deletions
diff --git a/t/t2010-checkout-ambiguous.sh b/t/t2010-checkout-ambiguous.sh index 7cc0a3582..87bdf9c96 100755 --- a/t/t2010-checkout-ambiguous.sh +++ b/t/t2010-checkout-ambiguous.sh @@ -47,4 +47,10 @@ test_expect_success 'disambiguate checking out from a tree-ish' ' git diff --exit-code --quiet ' +test_expect_success 'accurate error message with more than one ref' ' + test_must_fail git checkout HEAD master -- 2>actual && + grep 2 actual && + test_i18ngrep "one reference expected, 2 given" actual +' + test_done diff --git a/t/t2024-checkout-dwim.sh b/t/t2024-checkout-dwim.sh index 094b92ef4..6ecb55946 100755 --- a/t/t2024-checkout-dwim.sh +++ b/t/t2024-checkout-dwim.sh @@ -164,4 +164,25 @@ test_expect_success 'checkout of branch from a single remote succeeds #4' ' test_branch_upstream eggs repo_d eggs ' +test_expect_success 'checkout of branch with a file having the same name fails' ' + git checkout -B master && + test_might_fail git branch -D spam && + + >spam && + test_must_fail git 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 && + + >spam && + git checkout spam -- && + test_branch spam && + test_cmp_rev refs/remotes/extra_dir/repo_c/extra_dir/spam HEAD && + test_branch_upstream spam repo_c spam +' + test_done |