git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Marc Branchaud <marcnarc@xiplink.com>
To: Phil Hord <phil.hord@gmail.com>
Cc: git@vger.kernel.org, gitster@pobox.com, Jens.Lehmann@web.de,
	peff@peff.net
Subject: Re: [PATCH 4/6] Teach "git remote" about remote.default.
Date: Fri, 06 Jul 2012 10:43:34 -0400	[thread overview]
Message-ID: <4FF6F996.8080205@xiplink.com> (raw)
In-Reply-To: <CABURp0oYfzKrkKOZJrH2hrYMTPbFe_i5mMKQ3HnWQdGZa=oujw@mail.gmail.com>

On 12-07-06 08:51 AM, Phil Hord wrote:
> On Thu, Jul 5, 2012 at 6:11 PM,  <marcnarc@xiplink.com> wrote:
>> From: Marc Branchaud <marcnarc@xiplink.com>
>>
>> The "rename" and "rm" commands now handle the case where the remote being
>> changed is the default remote.
> 
> I think this is the right thing to do.  But I noticed a subtle
> behavior change that we may wish to consider.
> 
> Today I might do this (contrived example):
> 
> git checkout somelocalbranch
> git push # pushes to "origin" by default
> git remote rename origin origin1
> git add origin ssh://new-server/foo
> git push  # pushes to "origin" by default
> 
> But after this change, the last command is different.  Now it pushes
> to "origin1" because the rename set the remote.default to "origin1",
> even though it was previously not set at all.  It did this because the
> "oldname" is compared to the "remote_get_default_name()", which
> returns "origin" by default.  So the old setting, which did not exist,
> is now "renamed" to have an actual value, and the actual value is not
> "origin".
> 
> One can easily contrive an alternative example showing that this is a
> good thing.  As I said, I think it is the right thing to do.
> 
> But it is different, I think.

Yes, I agree it is different.

> I doubt many script writers are counting on default settings to carry
> the day, so they are probably more explicit about how they push.  But
> I didn't see this mentioned in the patch.

I think this sort of thing is better suited to the documentation of
remote.default.  I'm planning to re-roll this series with documentation
updates, and I'll include your example.

		M.

  reply	other threads:[~2012-07-06 14:43 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
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 [this message]
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=4FF6F996.8080205@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 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).