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

Re: [PATCH 2/2] merge: make sure to terminate message with newline

From
Junio C Hamano <gitster@pobox.com>
Date
Jul 16, 2021, 20:20 UTC
Message-ID
<xmqqeebyqadi.fsf@gitster.g>
In-Reply-To
<31371c25743e1001b4fac89e80e7206ff477ac8a.1626421416.git.gitgitgadget@gmail.com>
"Luca Weiss via GitGitGadget" <gitgitgadget@gmail.com> writes:
> From: Luca Weiss <luca@z3ntu.xyz>

Please explain what you are trying to fix here. The title hints that this change is to deal with an message that ends in an incomplete line, but where does that incomplete line come?

I find it somewhat important to know that details especially because in this patch ...

Show 14 quoted lines
> Signed-off-by: Luca Weiss <luca@z3ntu.xyz>
> ---
>  builtin/merge.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/builtin/merge.c b/builtin/merge.c
> index a8a843b1f54..646bb49367f 100644
> --- a/builtin/merge.c
> +++ b/builtin/merge.c
> @@ -867,6 +867,7 @@ static void prepare_to_commit(struct commit_list *remoteheads)
>  	}
>  	if (signoff)
>  		append_signoff(&msg, ignore_non_trailer(msg.buf, msg.len), 0);
> +	strbuf_complete_line(&msg);
... the placement of this call looks dubious.
Before the context of this hunk, we 
 - started with an empty msg at the beginning of this function;
 - added merge_msg to msg, where merge_msg came from options like -F
   and -m;
 - optionally added to msg comments to be shown in the editor; and
 - optionally called append_signoff() to add s-o-b.

At which step do we make msg end with an incomplete line and under what condition?

If it is after processing -F/-m and if we did not call the editor, for example, we "append" the sign-off after that incomplete line and your new call to strbuf_complete_line() would be too late if that is the case, wouldn't it? I do not know if that is, since your commit log message lacks meaningful details, and that is exactly why people want you to explain what breakage you observed and what your fix is.

Thanks.
>  	write_merge_heads(remoteheads);
>  	write_file_buf(git_path_merge_msg(the_repository), msg.buf, msg.len);
>  	if (run_commit_hook(0 < option_edit, get_index_file(), "prepare-commit-msg",
Previous: Luca WeissNext: Junio C Hamano
Message 16 of 17 in “Normalize newlines in merge & interpret-trailer”
  1. 0/2 Normalize newlines in merge & interpret-trailerLuca Weiss via GitGitGadget, Jul 16, 2021
  2. 1/2 trailer: handle input without trailing newlineLuca Weiss via GitGitGadget, Jul 16, 2021
  3. Jeff KingJul 16, 2021
  4. 2/2 merge: make sure to terminate message with newlineLuca Weiss via GitGitGadget, Jul 16, 2021
  5. Phillip WoodJul 16, 2021
  6. Luca WeissJul 16, 2021
  7. Phillip WoodJul 16, 2021
  8. Jeff KingJul 16, 2021
  9. Junio C HamanoJul 16, 2021
  10. Jeff KingJul 16, 2021
  11. Junio C HamanoJul 16, 2021
  12. Phillip WoodJul 17, 2021
  13. Jeff KingJul 17, 2021
  14. Luca WeissJul 21, 2021
  15. Luca WeissAug 26, 2021
  16. Junio C HamanoJul 16, 2021
  17. Junio C HamanoJul 16, 2021

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.