Re: [PATCH] branch: make sure the upstream remote is configured
- From
Carlos Martín Nieto <cmn@elego.de>
- Date
- Jul 26, 2013, 22:29 UTC
- Message-ID
- <1374877787.2670.6.camel@centaur.cmartin.tk>
- In-Reply-To
- <20130726184311.GA29799@sigill.intra.peff.net>
On Fri, 2013-07-26 at 14:43 -0400, Jeff King wrote:
Show 12 quoted lines
> On Fri, Jul 26, 2013 at 07:39:37PM +0200, Carlos Martín Nieto wrote:
>
> > A command of e.g.
> >
> > git push --set-upstream /tmp/t master
> >
> > will call install_branch_config() with a remote name of "/tmp/t". This
> > function will set the 'branch.master.remote' key to, which is
> > nonsensical as there is no remote by that name.
>
> Is it nonsensical? It does not make sense for the @{upstream} magic
> token, because we will not have a branch in tracking branch refs/remotesThis was the main point, yes; the only time I've seen it used is by mistake/misunderstanding, and thinking that you wouldn't want to do something like what's below.
You are also unable to do this kind of thing through git-branch, and as it seemed to be an oversight, I wanted to tighten it up.
Show 7 quoted lines
> to point to. But the configuration would still affect how "git pull" > chooses a branch to fetch and merge. > > I.e., you can currently do: > > git push --set-upstream /tmp/t master > git pull ;# pulls from /tmp/t master
Interestingly, this actually fetches the right branch from the remote. I wasn't expecting something like this to work at all.
Somewhat doubtful that this usage is something you'd really want to do, I see that it does behave properly.
cmn