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

Re: [PATCH] usage_with_options: omit double new line on empty option list

From
Junio C Hamano <gitster@pobox.com>
Date
Aug 25, 2017, 21:17 UTC
Message-ID
<xmqq4lsvs5y5.fsf@gitster.mtv.corp.google.com>
In-Reply-To
<CAGZ79kY6-R4Tt45BfnncH7tE46K8FG7RBDk+qb-tCU97CVQHvA@mail.gmail.com>
Stefan Beller <sbeller@google.com> writes:
> Upon closer inspection, I have the impression that f389c808b6
> (Rework make_usage to print the usage message immediately,
> 2007-10-14) introduced the extra new line without giving a rationale.

I do not think that is the case. The code before that patch collected all the usage strings in a strbuf sb, which had lines with their own terminating LFs, and then called usage() on sb.buf, which added an extra LF, so I think the commit was a faithful and bug-to-bug compatible rewrite.

But that does not matter in the bigger picture, as long as everybody agrees with the following:

Show 11 quoted lines
>> The other fputc('\n', outfile) that this version of the patch
>> touches is what I had trouble with, and I still do.  There must be a
>> similar rationale like the previous one, i.e. "We have finished
>> giving the usage, and we have finished showing all the options.  Now
>> we are about to further show X, so let's have a blank line here so
>> that what we have wrote will be separated from it", but I cannot
>> tell what that X is.
>
> Oh. I assumed that this X is the the next command in the users
> terminal, but I checked other commands and that is not the case
> at all (at least ls, vi, tar)
Thanks.
Previous: Stefan Beller
Message 4 of 4 in “usage_with_options: omit double new line on empty option list”
  1. usage_with_options: omit double new line on empty option listStefan Beller, Aug 25, 2017
  2. Junio C HamanoAug 25, 2017
  3. Stefan BellerAug 25, 2017
  4. Junio C HamanoAug 25, 2017

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.