git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: John Tapsell <johnflux@gmail.com>
To: Jeff King <peff@peff.net>
Cc: Pieter de Bie <pdebie@ai.rug.nl>,
	Sverre Rabbelier <srabbelier@gmail.com>,
	Johannes Schindelin <Johannes.Schindelin@gmx.de>,
	Git List <git@vger.kernel.org>
Subject: Re: git checkout -b origin/mybranch origin/mybranch
Date: Thu, 12 Mar 2009 16:16:09 +0000	[thread overview]
Message-ID: <43d8ce650903120916yb91113fy5485813c512c8108@mail.gmail.com> (raw)
In-Reply-To: <20090312153738.GA24690@coredump.intra.peff.net>

2009/3/12 Jeff King <peff@peff.net>:
> On Thu, Mar 12, 2009 at 03:21:48PM +0000, Pieter de Bie wrote:
>
>> You can also get this in other interactions, for example:
>>
>>       $ git checkout -b origin/test HEAD
>>       $ git checkout -b origin/test master
>>
>> yes, these might be user errors, but I still think it's not OK to create a
>> new ref 'refs/heads/origin/test' if there's also a 'refs/
>> remotes/origin/test' (as I've said a few months ago).
>
> One thing that has been missing from this discussion (and I think you
> are getting to it here) is a concrete rule for "X is harmful, and Y is
> not". That is, how do we know when to warn, and then what do we do?
>
> John's original example was "git checkout -b origin/test origin/test".
> So it's a problem that they're textually the same, but obviously there
> are more problematic cases.
>
> The behavior I think you are implying would be something like:
>
>  When making origin/test, try to resolve_ref("origin/test"); if it
>  fails, we are OK. If it succeeds, then we know we will be creating an
>  ambiguity. Complain and refuse the creation unless "-f" is given.
>
> This would actually be a superset of the "branch already exists" case,
> so it should be pretty simple to code, and it makes for a simple rule:
> it is now "ref already exists".

+1

I was thinking more along the lines of checking if it begins with
remotes/, origin/, tags/, stash/, bisect/    and blacklisting these.

Can anyone suggest a reason that you really might want to create a
branch called  origin/something ?


> Does that actually cover all of the problematic cases?
>
> -Peff
>

  reply	other threads:[~2009-03-12 16:17 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-12 11:36 git checkout -b origin/mybranch origin/mybranch John Tapsell
2009-03-12 11:40 ` Sverre Rabbelier
2009-03-12 11:43 ` Johannes Schindelin
2009-03-12 11:48   ` John Tapsell
2009-03-12 13:02     ` Johannes Schindelin
2009-03-12 13:18       ` John Tapsell
2009-03-12 13:43         ` Sverre Rabbelier
2009-03-12 14:14           ` John Tapsell
2009-03-13 14:08             ` Michael J Gruber
2009-03-12 15:21           ` Pieter de Bie
2009-03-12 15:37             ` Jeff King
2009-03-12 16:16               ` John Tapsell [this message]
2009-03-12 16:35                 ` Jeff King
2009-03-12 16:40                   ` Pieter de Bie
2009-03-12 16:51                     ` Jeff King
2009-03-12 16:58                       ` John Tapsell
2009-03-12 17:14                         ` Jeff King
2009-03-12 17:45                           ` John Tapsell
2009-03-12 16:45                   ` John Tapsell
2009-03-12 18:31         ` Junio C Hamano

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=43d8ce650903120916yb91113fy5485813c512c8108@mail.gmail.com \
    --to=johnflux@gmail.com \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=git@vger.kernel.org \
    --cc=pdebie@ai.rug.nl \
    --cc=peff@peff.net \
    --cc=srabbelier@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).