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

Re: [PATCH 2/5] sequencer: use skip_blank_lines() to find the commit subject

From
Junio C Hamano <gitster@pobox.com>
Date
Jun 29, 2016, 22:03 UTC
Message-ID
<xmqqpoqz1wmh.fsf@gitster.mtv.corp.google.com>
In-Reply-To
<69bc831064331117141c7153dc72e9e658691155.1467209576.git.johannes.schindelin@gmx.de>
Johannes Schindelin <johannes.schindelin@gmx.de> writes:
Show 26 quoted lines
> Just like we already taught the find_commit_subject() function (to make
> it consistent with the code in pretty.c), we now simply skip leading
> blank lines of the commit message.
>
> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
> ---
>  sequencer.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/sequencer.c b/sequencer.c
> index 7d7add6..cdfac82 100644
> --- a/sequencer.c
> +++ b/sequencer.c
> @@ -544,10 +544,8 @@ static int do_pick_commit(struct commit *commit, struct replay_opts *opts)
>  		 * information followed by "\n\n".
>  		 */
>  		p = strstr(msg.message, "\n\n");
> -		if (p) {
> -			p += 2;
> -			strbuf_addstr(&msgbuf, p);
> -		}
> +		if (p)
> +			strbuf_addstr(&msgbuf, skip_blank_lines(p + 2));
>  
>  		if (opts->record_origin) {
>  			if (!has_conforming_footer(&msgbuf, NULL, 0))

Here, msg.message was read in get_message() by calling logmsg_reencode() that reads from get_commit_buffer(). The code structure is exactly the same as the previous one.

Good.
Previous: Johannes SchindelinNext: Johannes Schindelin
Message 5 of 11 in “Use skip_blank_lines() for more commit messages”
  1. 0/5 Use skip_blank_lines() for more commit messagesJohannes Schindelin, Jun 29, 2016
  2. 1/5 commit -C: skip blank lines at the beginning of the messageJohannes Schindelin, Jun 29, 2016
  3. Junio C HamanoJun 29, 2016
  4. 2/5 sequencer: use skip_blank_lines() to find the commit subjectJohannes Schindelin, Jun 29, 2016
  5. Junio C HamanoJun 29, 2016
  6. 3/5 reset --hard: skip blank lines when reporting the commit subjectJohannes Schindelin, Jun 29, 2016
  7. 4/5 commit -S: avoid invalid pointer with empty messageJohannes Schindelin, Jun 29, 2016
  8. 5/5 Skip blank lines when matching <commit>^{/foo}Johannes Schindelin, Jun 29, 2016
  9. Junio C HamanoJun 29, 2016
  10. Johannes SchindelinJul 2, 2016
  11. Junio C HamanoJun 29, 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.