git.vger.kernel.org archive mirror
 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 <Jens.Lehmann@web.de>
Subject: Re: [PATCH] Try harder to find a remote when on a detached HEAD or non-tracking branch.
Date: Mon, 18 Jun 2012 17:40:00 -0400	[thread overview]
Message-ID: <4FDFA030.7080408@xiplink.com> (raw)
In-Reply-To: <7vaa004j9f.fsf@alter.siamese.dyndns.org>

On 12-06-18 01:33 PM, Junio C Hamano wrote:
> marcnarc@xiplink.com writes:
> 
>> From: Marc Branchaud <marcnarc@xiplink.com>
>>
>> get_default_remote() tries to use the checked-out branch's 'remote' config
>> value to figure out the remote's name.  This fails if there is no currently
>> checked-out branch (i.e. HEAD is detached) or if the checked-out branch
>> doesn't track a remote.  In these cases and the function would just fall
>> back to "origin".
>>
>> Instead, let's use the first remote listed in the configuration, and fall
>> back to "origin" only if we don't find any configured remotes.
> 
> I admit that I wouldn't do anything that relies on any remote to be
> used while on detached head myself, so in that sense I am a biased
> audience, but guessing (or not guessing and blindly assuming
> 'origin') feels wrong, and trying even harder to come up with an
> even wilder guess feels even more wrong.

OK, but what would be right?  AFAIK git doesn't have any real way of
designating an official default remote.  It seems to me that the first one in
the config is actually better than just using "origin".  At least, that
remote seems very likely to be the one used when the repo was cloned.

> Shouldn't we be erroring out instead?

That would be bad for our situation.  As I said, our automated build system
uses detached HEADs a lot.  Erroring-out in this case would break us.  It's
really only the near-ubiquity of the name "origin" that has kept things
working so far.

But we finally ran into a situation where someone used "git clone -o", and
that seems to have broken relative-path submodules in some situations.  (I
would not be at all surprised if "git clone -o" breaks an assortment of other
features, too.  I think there are a few places in the code where "origin" is
presumed to be a valid remote name, and also the one the user wants to use.)

		M.

  reply	other threads:[~2012-06-18 21:40 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-18 17:01 [PATCH] Try harder to find a remote when on a detached HEAD or non-tracking branch marcnarc
2012-06-18 17:33 ` Junio C Hamano
2012-06-18 21:40   ` Marc Branchaud [this message]
2012-06-18 22:12     ` Junio C Hamano
2012-06-19 14:07       ` Marc Branchaud
2012-06-19 17:55         ` Junio C Hamano
2012-06-19 19:31           ` Heiko Voigt
2012-06-19 21:42             ` Marc Branchaud
2012-06-20 17:42               ` Heiko Voigt
2012-06-19 20:12           ` Jeff King
2012-06-19 20:31             ` Junio C Hamano
2012-06-19 21:43             ` Marc Branchaud
2012-06-19 21:46               ` Jeff King
2012-06-19 21:58                 ` Junio C Hamano
2012-06-19 22:00                   ` Jeff King
2012-06-19 22:26                     ` Junio C Hamano
2012-06-19 19:41         ` Jens Lehmann
2012-06-19 21:43           ` Marc Branchaud
2012-06-20  2:49             ` Phil Hord
2012-06-18 17:53 ` Arnaud Lacombe

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=4FDFA030.7080408@xiplink.com \
    --to=marcnarc@xiplink.com \
    --cc=Jens.Lehmann@web.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).