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

Re: [PATCH v3 0/2] Make find_commit_subject() consistent with --format=%s

From
Junio C Hamano <gitster@pobox.com>
Date
Jun 22, 2016, 17:21 UTC
Message-ID
<xmqq1t3pnnpq.fsf@gitster.mtv.corp.google.com>
In-Reply-To
<cover.1466587806.git.johannes.schindelin@gmx.de>
Johannes Schindelin <johannes.schindelin@gmx.de> writes:
Show 5 quoted lines
> In an intermediate iteration of my rebase--helper patches, I
> accidentally generated commits with more than one empty line
> between the header and the commit message. When using
> find_commit_subject() to show the oneline, it turned up empty, even
> if the output of `git show --format=%s` looked fine.
Much easier to read with s/this developer/I/g ;-)
Show 7 quoted lines
> Turned out that the pretty-printing machinery helpfully skipped any
> blank lines before the commit message.
>
> In the first iteration of this patch, I failed to notice that
> the skip_empty_lines() function used by the pretty printing (which is
> declared static, and therefore I originally did not use it in order to
> keep the patch as minimal as possible) skips also blank lines.

By the way, I think skip_empty_lines() is misnamed, and I think your use of "blank lines" in the previous paragraph indicates that you agree ;-) It probably was OK back when it was a file-local static helper in pretty.c, but it becomes a part of the global API with 1/2, renaming it to skip_blank_lines() may be a good thing to do there at the same time.

I could do the tweaking while queuing if you too think it should happen; that way we'd save one roundtrip ;-).

> To make things truly consistent, I now just make the skip_empty_lines()
> function public, and then use it.
Thanks.  Interdiff looks sensible.
Previous: Johannes SchindelinNext: Johannes Schindelin
Message 11 of 15 in “Make find_commit_subject() more robust”
  1. Make find_commit_subject() more robustJohannes Schindelin, Jun 18, 2016
  2. Junio C HamanoJun 20, 2016
  3. Johannes SchindelinJun 21, 2016
  4. Junio C HamanoJun 21, 2016
  5. Johannes SchindelinJun 22, 2016
  6. Make find_commit_subject() more robustJohannes Schindelin, Jun 21, 2016
  7. Junio C HamanoJun 21, 2016
  8. 0/2 Make find_commit_subject() consistent with --format=%sJohannes Schindelin, Jun 22, 2016
  9. 2/2 Make find_commit_subject() more robustJohannes Schindelin, Jun 22, 2016
  10. 1/2 Make the skip_empty_lines() function publicJohannes Schindelin, Jun 22, 2016
  11. Junio C HamanoJun 22, 2016
  12. Johannes SchindelinJun 22, 2016
  13. 0/2 Make find_commit_subject() consistent with --format=%sJohannes Schindelin, Jun 22, 2016
  14. 1/2 Make the skip_blank_lines() function publicJohannes Schindelin, Jun 22, 2016
  15. 2/2 Make find_commit_subject() more robustJohannes Schindelin, Jun 22, 2016

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.