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

Re: how optparse can go horribly wrong

From
NSNicolas Sebrecht <nicolas.s.dev@gmx.fr>
Date
Sep 26, 2009, 01:51 UTC
Message-ID
<20090926015127.GA12994@vidovic>
In-Reply-To
<20090925233226.GC14660@spearce.org>
The 25/09/09, Shawn O. Pearce wrote:
Show 13 quoted lines
> *sigh*.  Someone just ran into this today:
> 
>   $ git commit -a -ammend
>   [work ce38944] mend
>    1 files changed, 2 insertions(+), 0 deletions(-)
> 
> Omit one - and include an extra 'm', and instead of --amend you
> have -a -m mend.  Which isn't exactly what you wanted.
> 
> We do catch -amend with an error though:
> 
>   $ git commit -amend
>   error: did you mean `--amend` (with two dashes ?)

OTOH, this is a bit odd because a commit with the message "end" makes perfect sense for a "fast and crappy commit local workflow".

And we allow -ammend (with two 'm')
  $ git commit -ammend
  [next 101f014] mend
   1 files changed, 1 insertions(+), 0 deletions(-)
  $
> I wonder, should the -m flag on commit not allow cuddling its
> value against the switch when its combined in short form with
> other switches?

Doing this only to -m flag would break consistency. That said, I don't have any opinion in disallowing the sticked form for _all_ short options.

-- 
Nicolas Sebrecht
Previous: Shawn O. PearceNext: Sverre Rabbelier
Message 2 of 21 in “how optparse can go horribly wrong”
  1. Shawn O. PearceSep 25, 2009
  2. Nicolas SebrechtSep 26, 2009
  3. Sverre RabbelierSep 26, 2009
  4. Shawn O. PearceSep 26, 2009
  5. Clemens BuchacherSep 28, 2009
  6. 1/2 do not mangle short options which take argumentsClemens Buchacher, Oct 1, 2009
  7. 2/2 allow mangling short options which take integer argumentsClemens Buchacher, Oct 1, 2009
  8. Johannes SchindelinOct 1, 2009
  9. Clemens BuchacherOct 2, 2009
  10. Jeff KingOct 2, 2009
  11. Clemens BuchacherOct 2, 2009
  12. Johannes SchindelinOct 2, 2009
  13. Clemens BuchacherOct 3, 2009
  14. Johannes SchindelinOct 1, 2009
  15. Jeff KingOct 2, 2009
  16. Clemens BuchacherOct 2, 2009
  17. Paolo BonziniOct 2, 2009
  18. Jeff KingOct 2, 2009
  19. Johannes SchindelinOct 2, 2009
  20. Jeff KingOct 2, 2009
  21. Johannes SchindelinOct 2, 2009

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.