path: root/setup.c
diff options
authorJunio C Hamano <>2011-05-10 19:02:54 (GMT)
committerJunio C Hamano <>2011-05-10 19:37:54 (GMT)
commit2e83b66c32c1d482575fd8caed80680a2f69c5f1 (patch)
tree8b3fc22561a43f5abf81c4c6c88a194dc58180dd /setup.c
parent9619617d33c83ad873539384b3cbfd564053be76 (diff)
fix overslow :/no-such-string-ever-existed diagnostics
"git cmd :/no-such-string-ever-existed" runs an extra round of get_sha1() since 009fee4 (Detailed diagnosis when parsing an object name fails., 2009-12-07). Once without error diagnosis to see there is no commit with such a string in the log message (hence "it cannot be a ref"), and after seeing that :/no-such-string-ever-existed is not a filename (hence "it cannot be a path, either"), another time to give "better diagnosis". The thing is, the second time it runs, we already know that traversing the history all the way down to the root will _not_ find any matching commit. Rename misguided "gently" parameter, which is turned off _only_ when the "detailed diagnosis" codepath knows that it cannot be a ref and making the call only for the caller to die with a message. Flip its meaning (and adjust the callers) and call it "only_to_die", which is not a great name, but it describes far more clearly what the codepaths that switches their behaviour based on this variable do. On my box, the command spends ~1.8 seconds without the patch to make the report; with the patch it spends ~1.12 seconds. Signed-off-by: Junio C Hamano <>
Diffstat (limited to 'setup.c')
1 files changed, 1 insertions, 1 deletions
diff --git a/setup.c b/setup.c
index 84f71d5..7fde4fa 100644
--- a/setup.c
+++ b/setup.c
@@ -86,7 +86,7 @@ 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);
+ 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);