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

Re: [RFC PATCH 1/2] Allow "git log --grep foo" as synonym for "git log --grep=foo".

From
Jakub Narebski <jnareb@gmail.com>
Date
Jul 27, 2010, 10:24 UTC
Message-ID
<m3ocdtkytn.fsf@localhost.localdomain>
In-Reply-To
<buohbjll3l9.fsf@dhlpc061.dev.necel.com>
Miles Bader <miles@gnu.org> writes:
> Sverre Rabbelier <srabbelier@gmail.com> writes:
Show 14 quoted lines
>>> +       } else if (!strcmp(arg, "--grep")) {
>>> +               add_message_grep(revs, optarg);
>>> +               return 2;
>>
>> This one makes a little less sense since to me '--flag' are always
>> booleans, whereas '-m' can take an argument (such as '-m' from 'git
>> commit'.
> 
> The fact that --grep requires the "=" is amazingly confusing if you're
> used to standard GNU long-argument parsing (which many standard
> utilities use, and which git's argument syntax is clearly modelled
> after), where both forms are equivalent, and documentation typically
> only refers to the "=" form, but implicitly allows the separate-args
> form.
I think that parseopt allows both sticky (-mfoo, --message=foo) and
non-sticky (-m foo, --message foo) forms, if I remember it correctly
with exception of arguments with *optional* parameters which require
sticky form.
 
> I'm continually getting tripped up by git's idiosynchratic argument
> parsing, and it's nice to see it getting cleaned up a bit...

I guess that this solution is simpler than moving to parseopt... is that because log options and diff options crop everywhere? Do parseopt have no support for sub-parsers, like e.g. argp from libc:

  (libc.info.gz)Argp
  (libc.info.gz)Argp Children    
  http://www.gnu.org/s/libc/manual/html_node/Argp-Children.html
-- 
Jakub Narebski
Poland
ShadeHawk on #git
Previous: Miles BaderNext: Matthieu Moy
Message 5 of 20 in “Allow detached forms (--option arg) for git log options.”
  1. 0/2 Allow detached forms (--option arg) for git log options.Matthieu Moy, Jul 26, 2010
  2. 1/2 Allow "git log --grep foo" as synonym for "git log --grep=foo".Matthieu Moy, Jul 26, 2010
  3. Sverre RabbelierJul 27, 2010
  4. Miles BaderJul 27, 2010
  5. Jakub NarebskiJul 27, 2010
  6. Matthieu MoyJul 27, 2010
  7. Ævar Arnfjörð BjarmasonJul 27, 2010
  8. Matthieu MoyJul 27, 2010
  9. Ævar Arnfjörð BjarmasonJul 27, 2010
  10. Matthieu MoyJul 27, 2010
  11. Ævar Arnfjörð BjarmasonJul 27, 2010
  12. 2/2 Allow "git log -S string" as synonym for "git log -Sstring".Matthieu Moy, Jul 26, 2010
  13. Sverre RabbelierJul 27, 2010
  14. Jonathan NiederJul 26, 2010
  15. Pierre HabouzitJul 27, 2010
  16. Jakub NarebskiJul 27, 2010
  17. Pierre HabouzitJul 28, 2010
  18. Jakub NarebskiJul 29, 2010
  19. Pierre HabouzitJul 29, 2010
  20. Jonathan NiederAug 1, 2010

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.