Re: [question] how can i verify whether a local branch is tracking a remote branch?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Jeff King venit, vidit, dixit 06.04.2009 23:29:
> On Mon, Apr 06, 2009 at 02:00:34PM +0200, Michael J Gruber wrote:
> 
>>> +		if (!strcmp(name, "tracking")) {
>>> +			struct branch *branch;
>>> +			if (prefixcmp(ref->refname, "refs/heads/"))
>>> +				continue;
>>> +			branch = branch_get(ref->refname + 11);
>>> +			if (branch && branch->merge && branch->merge[0] &&
>>> +			    branch->merge[0]->dst)
>>> +				v->s = branch->merge[0]->dst;
>>
>> Isn't that missing out on those cases where you --track (i.e. follow) a
>> local (upstream) branch? See
>> 5e6e2b4 (Make local branches behave like remote branches when --tracked,
>> 2009-04-01)
> 
> I thought the logic was in branch_get to handle it. And indeed:
> 
>   $ git checkout --track -b new master
>   Branch new set up to track local branch master.
>   Switched to a new branch "new"
>   $ git for-each-ref --format='%(refname) %(tracking)'
>   refs/heads/master
>   refs/heads/new refs/heads/master
> 
> So it will point either to something in refs/remotes or in refs/heads,
> as applicable.

Uhm, yes, sorry for the noise. It was actually me who fixed branch_get()...

> 
>> If we hook it up into git-branch there would be to useful directions:
> 
> The difference being that git-branch is porcelain and git-for-each-ref
> is plumbing. So they really serve different purposes.
> 
>> - "git branch --follows foo" could list all branches which follow foo,
>> analogous to --contains. It gives you all your feature work on top of
>> foo, all branches affected by rebasing foo etc.
> 
> Sure, that would probably be useful.
> 
>> - "git branch --whatever foo" could list the branch whoch foo follows.
>>
>> I just notices that "git branch -v foo" does not give me the "-v" output
>> for foo... Improving that would open up the possibility to go for -vv foo.
> 
> See the "-vv" patch I just posted elsewhere in the thread.

I'll comment there ;)

Michael
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]