]> git.ipfire.org Git - thirdparty/git.git/commit - sha1-name.c
fix overslow :/no-such-string-ever-existed diagnostics
authorJunio C Hamano <gitster@pobox.com>
Tue, 10 May 2011 19:02:54 +0000 (12:02 -0700)
committerJunio C Hamano <gitster@pobox.com>
Tue, 10 May 2011 19:37:54 +0000 (12:37 -0700)
commit2e83b66c32c1d482575fd8caed80680a2f69c5f1
tree8b3fc22561a43f5abf81c4c6c88a194dc58180dd
parent9619617d33c83ad873539384b3cbfd564053be76
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 <gitster@pobox.com>
cache.h
setup.c
sha1_name.c