diff options
author | Junio C Hamano <gitster@pobox.com> | 2010-01-10 08:52:10 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2010-01-10 08:52:10 -0800 |
commit | 2b35fccf734ab1d30828d95ea34f1755d9183365 (patch) | |
tree | 442949aa91b05f7bd170edd987b09f7633025c6d /setup.c | |
parent | ed7e9ed5cdad5c3a5b947619a34154f5a0ebc020 (diff) | |
parent | 009fee4774d4fa607cd97519d1044e426ed423b8 (diff) | |
download | git-2b35fccf734ab1d30828d95ea34f1755d9183365.tar.gz |
Merge branch 'mm/diag-path-in-treeish'
* mm/diag-path-in-treeish:
Detailed diagnosis when parsing an object name fails.
Diffstat (limited to 'setup.c')
-rw-r--r-- | setup.c | 15 |
1 files changed, 13 insertions, 2 deletions
@@ -77,6 +77,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 @@ -90,8 +102,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); } /* |