From: Patrick Steinhardt Date: Fri, 17 Jul 2026 06:02:13 GMT Subject: Re: [PATCH 3/3] refspec: stop depending on `the_repository` Message-ID: In-Reply-To: On Thu, Jul 16, 2026 at 01:59:59PM -0700, Junio C Hamano wrote: > Patrick Steinhardt writes: > > > The only remaining user of `the_hash_algo` in "refspec.c" is > > `refspec_append()`, which needs to know the hash algorithm so that it > > can parse the appended refspec item. In contrast to the functions > > adapted in the preceding commit, this function always operates on a > > `struct refspec`. As that structure is expected to only ever contain > > refspecs that all use the same hash function it doesn't make sense > > though to adapt each caller. > > > > Instead, adapt the structure itself so that it gets initialized with a > > hash function and use that hash function to parse new refspec items. > > Adapt callers accordingly. > > > > This removes the final dependency on the global repository variable in > > "refspec.c", so we can drop `USE_THE_REPOSITORY_VARIABLE`. > > While we lost some references to the_repository, we gained > more references to the_hash_algo in exchange. Because > the_hash_algo is defined in terms of the_repository->hash_algo, > it is only available when the_repository is still in use. > So these changes do not really help callers, and only leave > more for them to clean up later. > > Which is probably fine. We have to start somewhere, and > refspec parsing is a fairly well-isolated corner of the > universe that serves as a good starting point. Yup, this patch series follows our typical approach of making one subsystem `the_repository`-clean, but bumping that dependency up into the next-higher level. I've got a bunch of follow-up patch series that'll also convert some of those higher-up dependencies. Most importantly, I'm converting all subsystems that relate to the transport layer, as I'm on a very naive quest to try and get git-clone(1) working without `the_repository`. Let's see how far I get. Patrick