Re: [PATCH] Try harder to find a remote when on a detached HEAD or non-tracking branch.
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Jun 18, 2012, 17:33 UTC
- Message-ID
- <7vaa004j9f.fsf@alter.siamese.dyndns.org>
- In-Reply-To
- <1340038866-24552-1-git-send-email-marcnarc@xiplink.com>
marcnarc@xiplink.com writes:
Show 10 quoted lines
> 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.
Shouldn't we be erroring out instead?