From: Junio C Hamano Date: Wed, 22 Aug 2012 18:51:53 +0000 (-0700) Subject: Merge branch 'mm/die-with-dashdash-help' X-Git-Tag: v1.8.0-rc0~149 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/64336ebe3413e07dcf9e0bcaba93884caab8d65d?ds=inline;hp=-c Merge branch 'mm/die-with-dashdash-help' When the user gives an argument that can be taken as both a revision name and a pathname without disambiguating with "--", we used to give a help message "Use '--' to separate". The message has been clarified to show where that '--' goes on the command line. * mm/die-with-dashdash-help: setup: clarify error messages for file/revisions ambiguity --- 64336ebe3413e07dcf9e0bcaba93884caab8d65d diff --combined setup.c index 9139beefc7,7663a4cbb2..3a1b2fd455 --- a/setup.c +++ b/setup.c @@@ -77,22 -77,27 +77,23 @@@ static void NORETURN die_verify_filenam const char *arg, int diagnose_misspelt_rev) { - unsigned char sha1[20]; - unsigned mode; - if (!diagnose_misspelt_rev) die("%s: no such path in the working tree.\n" - "Use '-- ...' to specify paths that do not exist locally.", + "Use 'git -- ...' to specify paths that do not exist locally.", arg); /* * 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. + * let maybe_die_on_misspelt_object_name() even trigger. */ if (!(arg[0] == ':' && !isalnum(arg[1]))) - /* try a detailed diagnostic ... */ - get_sha1_with_mode_1(arg, sha1, &mode, 1, prefix); + maybe_die_on_misspelt_object_name(arg, 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); + "Use '--' to separate paths from revisions, like this:\n" + "'git [...] -- [...]'", arg); } @@@ -141,7 -146,8 +142,8 @@@ void verify_non_filename(const char *pr if (!check_filename(prefix, arg)) return; die("ambiguous argument '%s': both revision and filename\n" - "Use '--' to separate filenames from revisions", arg); + "Use '--' to separate paths from revisions, like this:\n" + "'git [...] -- [...]'", arg); } /*