Re: [PATCH v2 2/2] checkout: proper error message on 'git checkout foo bar --'

2013-09-26 Thread Matthieu Moy
Jonathan Nieder writes: > (a) rename has_dash_dash here to dash_dash_pos, or > (b) put the check in the loop, like so: I agree with (a), but not with (b). I think separating the computation of the position and the diagnosis makes it clearer. I reworked the code a bit, the diagnosis part now l

Re: [PATCH v2 2/2] checkout: proper error message on 'git checkout foo bar --'

2013-09-25 Thread Jonathan Nieder
Hi, Matthieu Moy wrote: > 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 > "--", a

[PATCH v2 2/2] checkout: proper error message on 'git checkout foo bar --'

2013-09-25 Thread Matthieu Moy
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