Re: [PATCH 2/2] Be more careful when determining whether a remote was configured
- From
Johannes Schindelin <johannes.schindelin@gmx.de>
- Date
- Jan 18, 2017, 12:34 UTC
- Message-ID
- <alpine.DEB.2.20.1701181334040.3469@virtualbox>
- In-Reply-To
- <20170117214723.p5rni6wwggei366j@sigill.intra.peff.net>
Hi Peff,
On Tue, 17 Jan 2017, Jeff King wrote:
Show 28 quoted lines
> On Tue, Jan 17, 2017 at 10:19:24PM +0100, Johannes Schindelin wrote: > > > One of the really nice features of the ~/.gitconfig file is that users > > can override defaults by their own preferred settings for all of their > > repositories. > > > > One such default that some users like to override is whether the > > "origin" remote gets auto-pruned or not. The user would simply call > > > > git config --global remote.origin.prune true > > > > and from now on all "origin" remotes would be pruned automatically when > > fetching into the local repository. > > > > There is just one catch: now Git thinks that the "origin" remote is > > configured, as it does not discern between having a remote whose > > fetch (and/or push) URL and refspec is set, and merely having > > preemptively-configured, global flags for specific remotes. > > > > Let's fix this by telling Git that a remote is not configured unless any > > fetch/push URL or refspect is configured explicitly. > > Hmm. Old versions of GitHub for Windows used to set fetch refspecs in > the system gitconfig, for a similar purpose to what you want to do with > remote.origin.prune. > > I notice here that setting a refspec _does_ define a remote. Is there a > reason you drew the line there, and not at, say, whether it has a URL?
I want to err on the side of caution. That's why.
Ciao, Johannes