diff options
author | Jeff King <peff@peff.net> | 2013-12-06 17:05:48 -0500 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2013-12-09 11:01:23 -0800 |
commit | 141856738152d02beac5d4270a310a6007597282 (patch) | |
tree | 138e775504613d7a88319076095bfa428427af56 /test-mktemp.c | |
parent | Git 1.8.5.1 (diff) | |
download | tgif-141856738152d02beac5d4270a310a6007597282.tar.xz |
rev-parse: correctly diagnose revision errors before "--"
Rev-parse understands that a "--" may separate revisions and
filenames, and that anything after the "--" is taken as-is.
However, it does not understand that anything before the
token must be a revision (which is the usual rule
implemented by the setup_revisions parser).
Since rev-parse prefers revisions to files when parsing
before the "--", we end up with the correct result (if such
an argument is a revision, we parse it as one, and if it is
not, it is an error either way). However, we misdiagnose
the errors:
$ git rev-parse foobar -- >/dev/null
fatal: ambiguous argument 'foobar': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
$ >foobar
$ git rev-parse foobar -- >/dev/null
fatal: bad flag '--' used after filename
In both cases, we should know that the real error is that
"foobar" is meant to be a revision, but could not be
resolved.
Signed-off-by: Jeff King <peff@peff.net>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'test-mktemp.c')
0 files changed, 0 insertions, 0 deletions