Re: [PATCH v2 02/16] object-name: allow skipping ambiguity checks in `get_oid()` family
- From
Jeff King <peff@peff.net>
- Date
- Feb 21, 2025, 08:00 UTC
- Message-ID
- <20250221080003.GD1988395@coredump.intra.peff.net>
- In-Reply-To
- <20250219-pks-update-ref-optimization-v2-2-e696e7220b22@pks.im>
On Wed, Feb 19, 2025 at 02:23:29PM +0100, Patrick Steinhardt wrote:
Show 8 quoted lines
> When reading an object ID via `get_oid_basic()` or any of its related > functions we perform a check whether the object ID is ambiguous, which > can be the case when a reference with the same name exists. While the > check is generally helpful, there are cases where it only adds to the > runtime overhead without providing much of a benefit. > > Add a new flag that allows us to disable the check. The flag will be > used in a subsequent commit.
If we are going to switch to this and get rid of the global warn_on_object_refname_ambiguity flag, I could see it being worth it.
But when I looked into doing that, it did not make much sense (there are too many code paths that share the same get_oid calls, and you'd have to plumb the flags through the stack).
So if we are going to leave the global flag anyway, and if your patch 3 is just changing all of update-ref to pass the per-call flag in every call, why don't we just skip this new mechanism and have update-ref unset the warn_on_object_refname_ambiguity flag?
That makes patch 3 a one-liner, and patches 1 and 2 can go away.
-Peff
PS Sorry, I haven't looked carefully at the rest of the series. I've been moving houses and am way back-logged on Git stuff, so don't count on me reviewing it anytime soon.