Skip to content
  • Matthieu Moy's avatar
    checkout: proper error message on 'git checkout foo bar --' · bca39695
    Matthieu Moy authored and Junio C Hamano's avatar Junio C Hamano committed
    
    
    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: default avatarMatthieu Moy <Matthieu.Moy@imag.fr>
    Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
    bca39695