git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 2/2] git-checkout: improve error messages, detect ambiguities.

From
Pierre Habouzit <madcoder@debian.org>
Date
Jul 24, 2008, 08:33 UTC
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:
Show 26 quoted lines
> Pierre Habouzit <madcoder@debian.org> 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
Previous: Junio C HamanoNext: SZEDER Gábor
Message 13 of 16 in “git-checkout: fix argument parsing to detect ambiguous arguments.”
  1. git-checkout: fix argument parsing to detect ambiguous arguments.Pierre Habouzit, Jul 23, 2008
  2. Pierre HabouzitJul 23, 2008
  3. Johannes SchindelinJul 23, 2008
  4. Pierre HabouzitJul 23, 2008
  5. git-checkout: fix argument parsing to detect ambiguous arguments.Pierre Habouzit, Jul 23, 2008
  6. Pierre HabouzitJul 23, 2008
  7. Johannes SchindelinJul 23, 2008
  8. Resubmit after a night of sleepPierre Habouzit, Jul 23, 2008
  9. 1/2 git-checkout: fix command line parsing.Pierre Habouzit, Jul 23, 2008
  10. 2/2 git-checkout: improve error messages, detect ambiguities.Pierre Habouzit, Jul 23, 2008
  11. Junio C HamanoJul 23, 2008
  12. Junio C HamanoJul 24, 2008
  13. Pierre HabouzitJul 24, 2008
  14. checkout: mention '--' in the docsSZEDER Gábor, Jul 23, 2008
  15. bash: offer only paths after '--' for 'git checkout'SZEDER Gábor, Jul 23, 2008
  16. Shawn O. PearceJul 25, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.