From: Jeff King Date: Tue, 31 Mar 2015 22:22:25 GMT Subject: Re: [PATCH 1/6] remote.c: drop default_remote_name variable Message-ID: <20150331222224.GA31948@peff.net> In-Reply-To: On Tue, Mar 31, 2015 at 01:37:35PM -0700, Junio C Hamano wrote: > > When we read the remote config from disk, we update a > > default_remote_name variable if we see branch.*.remote > > config for the current branch. This isn't wrong, or even all > > that complicated, but it is a bit simpler (because it > > reduces our overall state) to just lazily compute the > > default when we need it. > > > > The ulterior motive here is that the push config uses a > > similar structure, and _is_ much more complicated as a > > result. That will be simplified in a future patch, and it's > > more readable if the logic remotes and push-remotes matches. > > I cannot quite parse the part after "if..."; "the logic used by > remotes and push-remotes matches"? Sorry, it should have been "...if the logic for remotes and push-remotes matches". > > +static int loaded_remotes_config; > > + > > I expect that the reason why this is not a function scope static in > read_config() will be revealed in the later patch in this series... No, it's not used. I was leaving it as an "out" in case somebody ever needed to reset it in order to re-read the config, but I agree it is probably better to let them pull it out of the function if and when that happens. -Peff