summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 2e83b66)
raw | patch | inline | side by side (parent: 2e83b66)
author | Junio C Hamano <gitster@pobox.com> | |
Tue, 10 May 2011 19:05:01 +0000 (12:05 -0700) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Tue, 10 May 2011 19:38:06 +0000 (12:38 -0700) |
A colon followed by anything !isalnum() (e.g. ":/heh") at this point is
known not to be an existing rev. Just give a generic "neither a rev nor
a path" error message.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
known not to be an existing rev. Just give a generic "neither a rev nor
a path" error message.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
setup.c | patch | blob | history |
index 7fde4fac908b1932e0d17a8f8437e5a6bced0c8e..fd4ce59f28a275448ac4d34aeadd6f9875cc5911 100644 (file)
--- a/setup.c
+++ b/setup.c
{
unsigned char sha1[20];
unsigned mode;
- /* try a detailed diagnostic ... */
- get_sha1_with_mode_1(arg, sha1, &mode, 1, prefix);
+
+ /*
+ * Saying "'(icase)foo' does not exist in the index" when the
+ * user gave us ":(icase)foo" is just stupid. A magic pathspec
+ * begins with a colon and is followed by a non-alnum; do not
+ * let get_sha1_with_mode_1(only_to_die=1) to even trigger.
+ */
+ if (!(arg[0] == ':' && !isalnum(arg[1])))
+ /* try a detailed diagnostic ... */
+ get_sha1_with_mode_1(arg, sha1, &mode, 1, prefix);
+
/* ... or fall back the most general message. */
die("ambiguous argument '%s': unknown revision or path not in the working tree.\n"
"Use '--' to separate paths from revisions", arg);