checkout: proper error message on 'git checkout foo bar --'
commitbca39695343ecb113b30c72a3b2e0cb7e73757d8
authorMatthieu Moy <Matthieu.Moy@imag.fr>
Fri, 18 Oct 2013 09:25:58 +0000 (18 11:25 +0200)
committerJunio C Hamano <gitster@pobox.com>
Fri, 18 Oct 2013 19:57:16 +0000 (18 12:57 -0700)
tree1694059fa4ce68468a592c0072b6f6d2bb654d1c
parenta047fafc7866cc4087201e284dc1f53e8f9a32d5
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>
builtin/checkout.c
t/t2010-checkout-ambiguous.sh