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

Re: [RFH] convert shortlog to use parse_options

From
Pierre Habouzit <madcoder@debian.org>
Date
Dec 13, 2007, 20:53 UTC
Message-ID
<20071213205305.GA5423@artemis.madism.org>
In-Reply-To
<7vzlwe1jeb.fsf@gitster.siamese.dyndns.org>
On Thu, Dec 13, 2007 at 07:31:24PM +0000, Junio C Hamano wrote:
Show 6 quoted lines
> So I am not entirely opposed to your version, nor I am claiming my
> suggestion is better.  However, I just thought that "some parameters you
> MUST stick to the flag" might create confusion to the end users, and I
> wanted to see if others can come up with a less confusing alternative.
> And the way I did so was to keep the discussion going by stirring the
> pot a bit.

I understand that, and I hope I wasn't sounding harsh at all, I was just debating. Note that I don't like the asymmetry of some options needing a specific syntax whereas all the rest is lax. It's cumbersome at the very least. Though, to me there is one gain: when the user uses the --long-opt=foo version you are _sure_ about what he meant. When you have --long-opt foo you're not.

Your proposal tries hard to do what the user meant, with a reasonable
chance of being wrong. My proposal is on the conservative side, but
generate totally incomprehensible errors: if you do
  $ git describe --abbrev 10 HEAD
with my patch you get a not very nice
  fatal: Not a valid object name 10
as an answer. which is kind of going back to the kind of situations
parse-options is trying to avoid in the first place. I wouldn't be
really annoyed by my solution if we were able to generate an
intelligible error message instead. But guess what, if we were able to
do so, we would be able to fix the ambiguity in the first place *sigh*.

So maybe the thing would be to sleep on a it a bit and not taking any of my patches yet (not even in pu) and let people think. It's not a major problem, though it's one that must be fixed before 1.5.4 because we don't want a broken option parser ever be released.

Note that there is another path, that would be to disallow mixing of options with real arguments, and have an option separator (though with `--` having a distinct meaning in git, that wouldn't be that easy). But sadly some git commands already allowed such a thing, so imposing it in parse-options would be backward incompatible for those. And I believe many people are attached to this feature anyways.

-- 
·O·  Pierre Habouzit
··O                                                madcoder@debian.org
OOO                                                http://www.madism.org
Previous: Junio C HamanoNext: Pierre Habouzit
Message 50 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.