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:
authorMatthieu Moy <Matthieu.Moy@imag.fr>2013-10-18 13:25:58 +0400
committerJunio C Hamano <gitster@pobox.com>2013-10-18 23:57:16 +0400
commitbca39695343ecb113b30c72a3b2e0cb7e73757d8 (patch)
tree1694059fa4ce68468a592c0072b6f6d2bb654d1c /t/t2010-checkout-ambiguous.sh
parenta047fafc7866cc4087201e284dc1f53e8f9a32d5 (diff)
checkout: proper error message on 'git checkout foo bar --'
The previous code was detecting the presence of "--" by looking only at argument 1. As a result, "git checkout foo bar --" was interpreted as an ambiguous file/revision list, and errored out with: error: pathspec 'foo' did not match any file(s) known to git. error: pathspec 'bar' did not match any file(s) known to git. error: pathspec '--' did not match any file(s) known to git. This patch fixes it by walking through the argument list to find the "--", and now complains about the number of references given. Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t2010-checkout-ambiguous.sh')
-rwxr-xr-xt/t2010-checkout-ambiguous.sh6
1 files changed, 6 insertions, 0 deletions
diff --git a/t/t2010-checkout-ambiguous.sh b/t/t2010-checkout-ambiguous.sh
index 7cc0a3582e..87bdf9c96b 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