Re: Adding push configuration to .git/config
- From
Steffen Prohaska <prohaska@zib.de>
- Date
- Nov 22, 2007, 07:08 UTC
- Message-ID
- <C297CFC3-8DD0-4EEE-8FD3-BF997F6E269A@zib.de>
- In-Reply-To
- <7vabp79hjt.fsf@gitster.siamese.dyndns.org>
On Nov 22, 2007, at 2:48 AM, Junio C Hamano wrote:
Show 36 quoted lines
> Nico -telmich- Schottelius <nico-linux-git@schottelius.org> > writes: > >> Nice would be >> >> [branch "master"] >> remote-push = origin >> remote-push-merge = another_branch >> >> And thus perhaps also changing the existing specs: >> >> remote = ... to remote-fetch = ... >> merge = ... to remote-fetch-merge = > > I do not think doing this is worth it, not because I think a > single branch.$name.remote should be good enough for everybody, > but because once you need a separate remote each for fetching > and pushing, there is no reason to say one per direction is > enough. > > An alternative could be to split [remote "name"] url into two > variants, fetch-url and push-url. While fetching by default > from two places without telling from which one does not make any > sense, pushing by default to two different places is quite a > normal thing to do, and we already do support more than one url > entries in [remote "name"] section used for pushing. > > If we were to do this, it might also make sense to rename the > word 'origin' we use for the default remote name to 'default' or > something. People with shared repository workflow would fetch > from one repository and push back to the same repository, so the > distinction would not matter, but for others who need something > like you suggest, the default repository for fetching and > pushing are different, and while you may still consider where > you fetch from your 'origin', where you push into is not your > 'origin' anymore.
I like this idea.
But in addition, we should have a branch.$name.push line that can contain a remote head to push to. This can be used to manage push's default on a per-branch basis. So, different branches can have different default refspecs, even when they refer to the same remote.
The default remote of "git push" is either origin, or it is
specified in the branch configuration. The following rules
would then be used to find the refspecs to push. The first
rule that matches wins:
1) Command line overrides (e.g. "--all", "--current").
2) Check if branch.$name.push entry is available.
(Would we allow multiple entries?)
3) Check if remote.$remotename.push entries are available.
4) Use default rule, which pushes matching branches.Steffen