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

Re: [PATCH] builtin-tag: fix fallouts from recent parsopt restriction.

From
Pierre Habouzit <madcoder@debian.org>
Date
Dec 17, 2007, 20:42 UTC
Message-ID
<20071217204204.GA13004@artemis.madism.org>
In-Reply-To
<20071217203143.GA2105@coredump.intra.peff.net>
On Mon, Dec 17, 2007 at 08:31:43PM +0000, Jeff King wrote:
Show 16 quoted lines
> On Mon, Dec 17, 2007 at 11:52:29AM -0800, Junio C Hamano wrote:
> 
> > So in short, for an option that takes optional option-argument:
> 
> I agree with everything you said, except...
> 
> >    - if it is given as "--long-name", and there is a next word, see if
> >      that is plausible as its argument.  Get it and signal the caller
> >      you consumed it, if it is.  Ignore it and signal the caller you
> >      didn't, if it isn't.
> 
> This "plausible" makes me a little nervous, and I wonder why we want to
> support this at all. Is it
> 
>   1. We have traditionally supported "--abbrev 10"? I don't think this
>      is the case.
  Yes, that's why the restriction bugs me a bit too.
>   2. Consistency with "--non-optional-arg foo"? Do we have any such
>      non-optional long arguments? I didn't see any; I think we stick
>      with --non-optional-arg=foo everywhere.
  there are some, I don't recall the exact commands, but option parsing
was quite inconsistent in git (well still is), there are the very simple
loops that just do strcmp and look for the '=', there are the loops that
allow interleaving of options and arguments (and that rewrite argc/argv
a bit like parseopt does) and also the ones that allow the separate
mode, and the one that do both.
  The force-stick-mode is a regression for them.
Show 10 quoted lines
> >    - if it is given as "-s", and there is a next word, and if the option
> >      has long format counterpart as well, then see if the next word is
> >      plausible as its argument.  Get it and signal the caller you
> >      consumed it, if it is.  Ignore it and signal the caller you didn't,
> >      if it isn't.
> 
> Similarly, what is the goal here?
> 
>   1. Have we ever supported "-s foo"? Not for -B/-M/-C, nor for
>      shortlog's -w.
  Yes for git tag -n for example, and there are some other
examples, look at maint for commands that have been migrated to
parse_options, some behave like that, and more than one for sure.
>   3. It's longer to type.
  It's way more readable, but YMMV.
-- 
·O·  Pierre Habouzit
··O                                                madcoder@debian.org
OOO                                                http://www.madism.org
Previous: Jeff KingNext: Pierre Habouzit
Message 20 of 51 in “[RFH] convert shortlog to use parse_options”
  1. Jeff KingDec 13, 2007
  2. Pierre HabouzitDec 13, 2007
  3. Jeff KingDec 13, 2007
  4. Pierre HabouzitDec 13, 2007
  5. 1/2 parseopt: Enforce the use of the sticked form for optional arguments.Pierre Habouzit, Dec 13, 2007
  6. 2/2 parseopt: Add a gitcli(5) man page.Pierre Habouzit, Dec 13, 2007
  7. Wincent ColaiutaDec 13, 2007
  8. Pierre HabouzitDec 13, 2007
  9. (squashme) gitcli documentation fixupsJunio C Hamano, Dec 17, 2007
  10. Pierre HabouzitDec 17, 2007
  11. Pierre HabouzitDec 17, 2007
  12. builtin-tag: fix fallouts from recent parsopt restriction.Junio C Hamano, Dec 17, 2007
  13. Pierre HabouzitDec 17, 2007
  14. Junio C HamanoDec 17, 2007
  15. Pierre HabouzitDec 17, 2007
  16. Junio C HamanoDec 17, 2007
  17. Pierre HabouzitDec 17, 2007
  18. Junio C HamanoDec 17, 2007
  19. Jeff KingDec 17, 2007
  20. Pierre HabouzitDec 17, 2007
  21. Pierre HabouzitDec 17, 2007
  22. Jeff KingDec 17, 2007
  23. Pierre HabouzitDec 17, 2007
  24. Junio C HamanoDec 17, 2007
  25. Jeff KingDec 17, 2007
  26. Pierre HabouzitDec 17, 2007
  27. Pierre HabouzitDec 17, 2007
  28. Junio C HamanoDec 17, 2007
  29. Pierre HabouzitDec 17, 2007
  30. Pierre HabouzitDec 17, 2007
  31. Junio C HamanoDec 13, 2007
  32. Pierre HabouzitDec 13, 2007
  33. Pierre HabouzitDec 13, 2007
  34. Junio C HamanoDec 13, 2007
  35. Kristian HøgsbergDec 13, 2007
  36. Kristian HøgsbergDec 13, 2007
  37. Junio C HamanoDec 13, 2007
  38. Jeff KingDec 14, 2007
  39. Junio C HamanoDec 14, 2007
  40. Andreas EricssonDec 14, 2007
  41. Pierre HabouzitDec 14, 2007
  42. Junio C HamanoDec 14, 2007
  43. Pierre HabouzitDec 15, 2007
  44. Junio C HamanoDec 17, 2007
  45. Andreas EricssonDec 17, 2007
  46. Junio C HamanoDec 17, 2007
  47. Andreas EricssonDec 17, 2007
  48. Kristian HøgsbergDec 17, 2007
  49. Junio C HamanoDec 13, 2007
  50. Pierre HabouzitDec 13, 2007
  51. Pierre HabouzitDec 13, 2007

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.