All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marc Branchaud <marcnarc@xiplink.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org, Jens.Lehmann@web.de, peff@peff.net,
	phil.hord@gmail.com
Subject: Re: [PATCH 3/6] Teach clone to set remote.default.
Date: Fri, 06 Jul 2012 16:43:00 -0400	[thread overview]
Message-ID: <4FF74DD4.1060800@xiplink.com> (raw)
In-Reply-To: <7vd348of0z.fsf@alter.siamese.dyndns.org>

On 12-07-06 03:39 PM, Junio C Hamano wrote:
> Marc Branchaud <marcnarc@xiplink.com> writes:
> 
>> If remote.default isn't set, then if someone does
>> 		git remote rename origin foo
>> the default remote will still be "origin" (modulo the currently-checked-out
>> branch stuff).
> 
> Why?

Erm, actually, my statement is incorrect.  Doh!

> I thought the proposed semantics was "if remote.default is
> unset, the default value of 'origin' is used where remote.default
> would have been used _everywhere_".

Yes, true.

> If "remote rename" wants to
> update the value of remote.default from 'origin' to 'foo' (which may
> or may not be the right thing to do, for which a separate discussion
> seems to exist already),

Are you talking about the sub-thread Phil Hord & I spawned about patch #4?  I
think Phil & I are in agreement there that it is the right thing to do.  If
anyone disagrees please speak up!

> and if it sees that the repository does not
> have remote.default, shouldn't it still set it to 'foo', just like
> the case where remote.default exists and set to 'origin'?

The proposed code actually already does that.  I'll add a unit test for this
case.

So why change "git clone" to always set remote.default if the functionality
remains the same either way?

To me it makes a more consistent implementation.  Since "git remote add" sets
remote.default if it's adding the first remote to the repository, when clone
itself adds the first remote it should do the same.

Plus this approach makes "clone -o" also work without any special-casing, so
the code is cleaner, IMHO.

If this justification is adequate, I'll add it to the commit message.  It may
then make more sense to have this commit come after the "git remote" changes
in the series.

> Your updated "remote rename" must work correctly in a repository
> that was created long ago, where remote.default was not set to
> anything (and default 'origin' was used) after all.
> 
> Or am I missing some subtle issues?

I agree with that requirement, and believe the proposed code fulfils it.

		M.

  reply	other threads:[~2012-07-06 20:42 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-05 22:11 [PATCH 0/6] Default remote marcnarc
2012-07-05 22:11 ` [PATCH 1/6] Rename remote.c's default_remote_name static variables marcnarc
2012-07-05 22:11 ` [PATCH 2/6] Teach remote.c about the remote.default configuration setting marcnarc
2012-07-05 22:50   ` Junio C Hamano
2012-07-06 14:36     ` Marc Branchaud
2012-07-06 19:31       ` Junio C Hamano
2012-07-06 19:57         ` Marc Branchaud
2012-07-05 22:11 ` [PATCH 3/6] Teach clone to set remote.default marcnarc
2012-07-05 22:52   ` Junio C Hamano
2012-07-06 14:37     ` Marc Branchaud
2012-07-06 19:39       ` Junio C Hamano
2012-07-06 20:43         ` Marc Branchaud [this message]
2012-07-06 21:49           ` Marc Branchaud
2012-07-05 22:11 ` [PATCH 4/6] Teach "git remote" about remote.default marcnarc
2012-07-06 12:51   ` Phil Hord
2012-07-06 14:43     ` Marc Branchaud
2012-07-05 22:11 ` [PATCH 5/6] Test that plain "git fetch" uses remote.default when on a detached HEAD marcnarc
2012-07-05 22:11 ` [PATCH 6/6] Teach get_default_remote to respect remote.default marcnarc

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=4FF74DD4.1060800@xiplink.com \
    --to=marcnarc@xiplink.com \
    --cc=Jens.Lehmann@web.de \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=peff@peff.net \
    --cc=phil.hord@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.