Re: [PATCH] Introduce <branch>@{tracked} as shortcut to the tracked branch
- From
Michael J Gruber <git@drmicha.warpmail.net>
- Date
- Sep 10, 2009, 10:59 UTC
- Message-ID
- <4AA8DC23.6050500@drmicha.warpmail.net>
- In-Reply-To
- <200909101218.06789.johan@herland.net>
Johan Herland venit, vidit, dixit 10.09.2009 12:18:
Show 16 quoted lines
> On Thursday 10 September 2009, Michael J Gruber wrote:
>> Johannes Schindelin venit, vidit, dixit 10.09.2009 11:36:
>>> Often, it is quite interesting to inspect the branch tracked by a
>>> given branch. This patch introduces a nice notation to get at the
>>> tracked branch: '<branch>@{tracked}' can be used to access that
>>> tracked branch.
>>>
>>> A special shortcut '@{tracked}' refers to the branch tracked by the
>>> current branch.
>>
>> Sorry, I didn't know the name of the long form was up for discussion.
>> But it should certainly coincide with the key which for-each-ref
>> uses, shouldn't it? I don't care whether tracked or upstream, but
>> for-each-ref's "upstream" has set the precedent.
>
> ...and 'git branch --track' set an even earlier precedent...an unfortunate one, yes. It brings us back to an old discussion. The consensus was what's in the glossary:
tracking branch
A regular git branch that is used to follow changes from
another repository. A tracking branch should
not contain direct modifications or have local commits made
to it. A tracking branch can usually be
identified as the right-hand-side ref in a Pull: refspec.I.e., a tracking branch is something under refs/remotes/ (usually; I'll use that simplification).
If I checkout -b myworkonit refs/remotes/origin/theirstuff then myworkonit *does not track* origin/theirstuff according to the glossary (but git checkout says so, unfortunately, and the option is named likewise); rather, it has origin/theirstuff as its upstream.
In fact, refs/remotes/origin/theirstuff tracks whatever the name is on the left hand side of the correspondig fetch refspec.
Maybe this is a good time to either
- change the definition of "tracking branch" (to one having an upstream which is in refs/remotes/; and call "remote upbranch" what's in refs/remotes/) or - rename the option and output of git checkout -b/git branch --track.
Accordingly, either tracked or something else (such as upstream) would be appropriate for the for-each-ref key and the ref specifier.
Cheers, Michael