Re: [PATCH] sha1_name: don't resolve refs when core.warnambiguousrefs is false
- From
Jeff King <peff@peff.net>
- Date
- Jan 7, 2014, 17:13 UTC
- Message-ID
- <20140107171307.GA19482@sigill.intra.peff.net>
- In-Reply-To
- <CAEfQM484kqLSVeyjhYtg7GfXOQkQNjaO1FV2_U3uAqO=Nargdg@mail.gmail.com>
On Mon, Jan 06, 2014 at 07:35:04PM -0800, Brodie Rao wrote:
Show 12 quoted lines
> On Mon, Jan 6, 2014 at 7:32 PM, Brodie Rao <brodie@sf.io> wrote: > > This change ensures get_sha1_basic() doesn't try to resolve full hashes > > as refs when ambiguous ref warnings are disabled. > > > > This provides a substantial performance improvement when passing many > > hashes to a command (like "git rev-list --stdin") when > > core.warnambiguousrefs is false. The check incurs 6 stat()s for every > > hash supplied, which can be costly over NFS. > > Forgot to add: > > Signed-off-by: Brodie Rao <brodie@sf.io>
Looks good to me.
I wonder if I should have simply gone this route instead of adding warn_on_object_refname_ambiguity, and then people who want "cat-file --batch" to be fast could just turn off core.warnAmbiguousRefs. I wanted it to happen automatically, though. Alternatively, I guess "cat-file --batch" could just turn off warn_ambiguous_refs itself.
-Peff