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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



"Luca Weiss via GitGitGadget" <gitgitgadget@xxxxxxxxx> writes:

> From: Luca Weiss <luca@xxxxxxxxx>

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 ...

> Signed-off-by: Luca Weiss <luca@xxxxxxxxx>
> ---
>  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",



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux