X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=setup.c;h=5792eb7ddfbe9a3e520dcf33081a6c098061d643;hb=009fee4774d4fa607cd97519d1044e426ed423b8;hp=f67250b7c1f7b5a62c30de0122c404554357f61b;hpb=002a9ec005cd3d4273e3c6b7dbe7a2fb9e70c1bc;p=git.git diff --git a/setup.c b/setup.c index f67250b7c..5792eb7dd 100644 --- a/setup.c +++ b/setup.c @@ -74,6 +74,18 @@ int check_filename(const char *prefix, const char *arg) die_errno("failed to stat '%s'", arg); } +static void NORETURN die_verify_filename(const char *prefix, const char *arg) +{ + unsigned char sha1[20]; + unsigned mode; + /* try a detailed diagnostic ... */ + get_sha1_with_mode_1(arg, sha1, &mode, 0, 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); + +} + /* * Verify a filename that we got as an argument for a pathspec * entry. Note that a filename that begins with "-" never verifies @@ -87,8 +99,7 @@ void verify_filename(const char *prefix, const char *arg) die("bad flag '%s' used after filename", arg); if (check_filename(prefix, arg)) return; - die("ambiguous argument '%s': unknown revision or path not in the working tree.\n" - "Use '--' to separate paths from revisions", arg); + die_verify_filename(prefix, arg); } /*