On Fri, Feb 21, 2025 at 03:00:03AM -0500, Jeff King wrote: > On Wed, Feb 19, 2025 at 02:23:29PM +0100, Patrick Steinhardt wrote: > > > 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. Spoiler alert: I do have a patch series locally that gets rid of the global variable completely, and that series builds on top of the new flag I'm introducing here. So I'd prefer to keep it so that we can eventually have less callsites that rely on global state. Patrick