git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Jay Soffian" <jaysoffian@gmail.com>
To: "Junio C Hamano" <gitster@pobox.com>
Cc: git@vger.kernel.org, "Johannes Schindelin" <Johannes.Schindelin@gmx.de>
Subject: Re: [RFC PATCH 1/2] git-branch: allow --track to work w/local branches
Date: Sat, 16 Feb 2008 02:07:30 -0500	[thread overview]
Message-ID: <76718490802152307h37796d32tfccb7571d48a3221@mail.gmail.com> (raw)
In-Reply-To: <7v7ih5fpve.fsf@gitster.siamese.dyndns.org>

On Feb 16, 2008 12:10 AM, Junio C Hamano <gitster@pobox.com> wrote:
> Although I am not so familiar with this area, the patch somehow
> did not feel right, so I ended up doing a bit of digging.
>
> After the context of the patch, we have this:
>
>         if (tracking.matches == 1) {
>                 sprintf(key, "branch.%s.remote", new_ref);
>                 git_config_set(key, tracking.remote ?  tracking.remote : ".");
>                 sprintf(key, "branch.%s.merge", new_ref);
>                 git_config_set(key, tracking.src);
>
> So it looks to me that the code already has intention to set the
> "branch.*.remote" variable to "." when certain condition is met.
> And the condition is "when tracking.remote is NULL, or it is
> already a dot".

I was confused by the use of the ternary operator. I couldn't figure
out how tracking.remote could be NULL. I chalked it up to bit-rot
but them forget to mention that in my email. I'm glad you took
another look, but I still don't understand how tracking.remote can
be NULL and tracking.matches == 1.

> So if there is a remote whose name is "." (or NULL, but I do not
> know when that can happen --- remote.c::make_remote() does not
> allow creating such a remote as far as I can tell), that would
> be found without the added extra code, wouldn't it?
>
> I did a bit of experiment and with this in .git/config:
>
>         [remote "."]
>                 fetch = refs/*:refs/*
>
> it turns out that you do not have to patch the code at all.  The
> above manual configuration feels somewhat like an ugly hack but
> perhaps we should make the above two lines implied?

Hmm, that just causes tracking.remote to be set to ".", not to NULL?
Right?

j.

  reply	other threads:[~2008-02-16  7:08 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-16  3:45 [RFC PATCH 1/2] git-branch: allow --track to work w/local branches Jay Soffian
2008-02-16  3:45 ` [RFC PATCH 2/2] new --rebase option to set branch.*.rebase for new branches Jay Soffian
2008-02-16  5:10 ` [RFC PATCH 1/2] git-branch: allow --track to work w/local branches Junio C Hamano
2008-02-16  7:07   ` Jay Soffian [this message]
2008-02-16 11:45   ` Johannes Schindelin
2008-02-17 18:05     ` Jay Soffian

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=76718490802152307h37796d32tfccb7571d48a3221@mail.gmail.com \
    --to=jaysoffian@gmail.com \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
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;
as well as URLs for NNTP newsgroup(s).