aboutsummaryrefslogtreecommitdiff
path: root/setup.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2010-01-10 08:52:10 -0800
committerJunio C Hamano <gitster@pobox.com>2010-01-10 08:52:10 -0800
commit2b35fccf734ab1d30828d95ea34f1755d9183365 (patch)
tree442949aa91b05f7bd170edd987b09f7633025c6d /setup.c
parented7e9ed5cdad5c3a5b947619a34154f5a0ebc020 (diff)
parent009fee4774d4fa607cd97519d1044e426ed423b8 (diff)
downloadgit-2b35fccf734ab1d30828d95ea34f1755d9183365.tar.gz
git-2b35fccf734ab1d30828d95ea34f1755d9183365.tar.xz
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.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/setup.c b/setup.c
index 2cf0f1993..3a07aa4df 100644
--- a/setup.c
+++ b/setup.c
@@ -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);
}
/*