Re: [PATCH v2 1/1] pack-objects: ignore ambiguous object warnings
From: Jeff King <hidden>
Date: 2018-11-06 21:12:38
On Tue, Nov 06, 2018 at 12:34:47PM -0800, Derrick Stolee via GitGitGadget wrote:
From: Derrick Stolee <redacted> A git push process runs several processes during its run, but one includes git send-pack which calls git pack-objects and passes the known have/wants into stdin using object ids. However, the default setting for core.warnAmbiguousRefs requires git pack-objects to check for ref names matching the ref_rev_parse_rules array in refs.c. This means that every object is triggering at least six "file exists?" queries. When there are a lot of refs, this can add up significantly! I observed a simple push spending three seconds checking these paths.
Thanks, this fills out the details from the cover letter a bit better.
The fix here is similar to 4c30d50 "rev-list: disable object/refname ambiguity check with --stdin". Save the value of the global warn_on_object_refname_ambiguity variable (which is usually set to the boolean config variable core.warnAmbiguousRefs) and change the state to false. Do this only during the get_object_list() method which reads the objects from stdin.
I think this parenthetical isn't quite right. We never change the value of warn_on_object_refname_ambiguity based on user config. It's just that if warn_ambiguous_refs is off, we do not even bother looking at the object_refname variant. So we'd never expect to see anything except "1" in our save_warning variable. Doing a save/restore is just about code hygiene and maintainability. Other than that minor nit, this whole thing looks good to me. -Peff