From: Pierre Habouzit Date: Thu, 24 Jul 2008 08:33:22 GMT Subject: Re: [PATCH 2/2] git-checkout: improve error messages, detect ambiguities. Message-ID: <20080724083322.GB10950@artemis.madism.org> In-Reply-To: <7v7ibc9p93.fsf@gitster.siamese.dyndns.org> On Wed, Jul 23, 2008 at 11:04:08PM +0000, Junio C Hamano wrote: > Pierre Habouzit writes: > > > The patch is twofold: it moves the option consistency checks just under > > the parse_options call so that it doesn't get in the way of the tree > > reference vs. pathspecs desambiguation. > > I think this goes a bit too far. > > Even if you have a file called 'master' tracked in your project, when you > say: > > $ git checkout master > > that's almost always branch switching. Forcing "git checkout master --" > disambiguation for such a common case is simply a wrong thing to do from > the usability point of view. > > So how about (obviously we are interested only in the case without > disambiguating '--' here): > > (3-1) if there is only one token left and if it is a rev, that's the > branch to check out or commit to detach to. > > (3-2) otherwise the user might have mistyped one of the paths, so help > avoiding by making sure the first token is unambiguously either > a rev or a path (but not both). It sounds really reasonable, and your patch seems really fine. -- ·O· Pierre Habouzit ··O madcoder@debian.org OOO http://www.madism.org