From: Michael J Gruber <git@drmicha•warpmail.net>
To: Jeff King <peff@peff•net>
Cc: Paolo Ciarrocchi <paolo.ciarrocchi@gmail•com>,
git@vger•kernel.org, Junio C Hamano <gitster@pobox•com>
Subject: Re: [question] how can i verify whether a local branch is tracking a remote branch?
Date: Tue, 07 Apr 2009 09:59:47 +0200 [thread overview]
Message-ID: <49DB07F3.4000704@drmicha.warpmail.net> (raw)
In-Reply-To: <20090406212935.GB882@coredump.intra.peff.net>
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
prev parent reply other threads:[~2009-04-07 8:01 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-04-05 10:32 [question] how can i verify whether a local branch is tracking a remote branch? Paolo Ciarrocchi
2009-04-05 14:44 ` Jeff King
2009-04-05 21:25 ` Paolo Ciarrocchi
2009-04-06 4:34 ` Jeff King
2009-04-06 5:28 ` Junio C Hamano
2009-04-06 5:49 ` Jeff King
2009-04-06 8:30 ` Paolo Ciarrocchi
2009-04-06 21:25 ` Jeff King
2009-04-06 22:00 ` Paolo Ciarrocchi
2009-04-07 4:41 ` Jeff King
2009-04-06 12:00 ` Michael J Gruber
2009-04-06 21:29 ` Jeff King
2009-04-07 7:59 ` Michael J Gruber [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=49DB07F3.4000704@drmicha.warpmail.net \
--to=git@drmicha$(echo .)warpmail.net \
--cc=git@vger$(echo .)kernel.org \
--cc=gitster@pobox$(echo .)com \
--cc=paolo.ciarrocchi@gmail$(echo .)com \
--cc=peff@peff$(echo .)net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox