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

Re: Patch that modifies git usage message

From
Stefan Beller <sbeller@google.com>
Date
May 1, 2015, 16:55 UTC
Message-ID
<CAGZ79kY4zJ2EhrtinaWChX=hLKywFu38wpF-mo=xrturxVh0=g@mail.gmail.com>
In-Reply-To
<xmqqfv7gxnup.fsf@gitster.dls.corp.google.com>
On Fri, May 1, 2015 at 9:29 AM, Junio C Hamano <gitster@pobox.com> wrote:
Show 18 quoted lines
> Stefan Beller <sbeller@google.com> writes:
>
>> For the patch itself:
>>
>> $ grep -r usage *.c builtin/*.c |wc -l
>> 551
>> $ grep -r Usage *.c builtin/*.c |wc -l
>> 3
>>
>> The community agreed (maybe subconciously) to prefer lower case
>> for the 'usage' string, so I don't think this is an improvement.
>
> I tend to agree with the conclusion, but you need to be a bit
> careful here.  These catch all the variable names that contain
> "[uU]sage" as substring, but we do not spell in-code variables
> with camelCase, so the former probably is over-counting.  Things
> like "static const char usage[] = ..." are counted; so are calls
> to usage_with_options().

I knew my search was off as I did not think it through, but I just wanted to have at least some data to not be hand waving only here.

Maybe we can also rely on the colon in this case: $ grep -r "usage:" *.{c,sh,perl} finds 22 results, 21 thereof look like human readable usage instructions $ grep -r "Usage:" *.{c,sh,perl} finds 2 results which look like human readable text

Show 20 quoted lines
>
> If you look for the beginning of a string constant, you would get
> this:
>
>     $ git grep '"usage' -- \*.c builtin/\*.c
>     12
>     $ git grep '"Usage' -- \*.c builtin/\*.c
>     0
>
> The former undercounts the messages because many usage messages are
> produced by calling usage_with_options() these days.
>
> The latter being zero made me scratch my head and do this:
>
>     $ git grep Usage -- \*.c builtin/\*.c
>     commit.c: * Usage example:
>     test-hashmap.c: * Usage: time echo "perfhas...
>
> I cannot find the third one you found for "Usage" in your example,
> though.

test-submodule-config.c: fprintf(stderr, "Usage: %s [<commit> <submodulepath>] ...\n", argv[0]); (I just realize HEAD wa pointing somewhere in pu)

Previous: Eric Sunshine
Message 10 of 10 in “Patch that modifies git usage message”
  1. Alangi DerickMay 1, 2015
  2. Stefan BellerMay 1, 2015
  3. Alangi DerickMay 1, 2015
  4. Junio C HamanoMay 1, 2015
  5. Alangi DerickMay 1, 2015
  6. Stefan BellerMay 1, 2015
  7. Eric SunshineMay 1, 2015
  8. Alangi DerickMay 1, 2015
  9. Eric SunshineMay 1, 2015
  10. Stefan BellerMay 1, 2015

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.