Re: [PATCH] cherry-pick -x: always insert an empty line

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

 



Beat Bolli <bbolli@xxxxxxxxx> writes:

> When cherry-picking a commit that has only a summary, the -x option
> creates an invalid commit message because it puts the hash of the commit
> being picked on the second line which should be left empty.
>
> This patch fixes this buglet by always inserting an empty line before
> the added line.
>
> Aside from that, even with a non-trivial commit the generated note
> "(cherry picked from commit 555c9864971744abb558796aea28e12a1ac20839)"
> seems abrupt when appended directly.
>
> Cc: Eric Raible <raible@xxxxxxxxxxx>
> Signed-off-by: Beat Bolli <bbolli@xxxxxxxxx>
> ---
>  sequencer.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/sequencer.c b/sequencer.c
> index 5fcbcb8..63fd589 100644
> --- a/sequencer.c
> +++ b/sequencer.c
> @@ -382,7 +382,7 @@ static int do_pick_commit(struct commit *commit, struct replay_opts *opts)
>  		}
>  
>  		if (opts->record_origin) {
> -			strbuf_addstr(&msgbuf, "(cherry picked from commit ");
> +			strbuf_addstr(&msgbuf, "\n(cherry picked from commit ");

Doesn't this need to be conditional?

If we cherry pick your commit somewhere else with "-x -s", the resulting
commit log message would end like this:

    Aside from that, even with a non-trivial commit the generated note
    "(cherry picked from commit 555c9864971744abb558796aea28e12a1ac20839)"
    seems abrupt when appended directly.

    Cc: Eric Raible <raible@xxxxxxxxxxx>
    Signed-off-by: Beat Bolli <bbolli@xxxxxxxxx>

    (cherry picked from commit 555c9864971744abb558796aea28e12a1ac20839)
    Signed-off-by: Frotz Xyzzy <nitfol@xxxxxxxxxx>

which clearly is worse-looking with the extra LF you added in this patch.

>  			strbuf_addstr(&msgbuf, sha1_to_hex(commit->object.sha1));
>  			strbuf_addstr(&msgbuf, ")\n");
>  		}
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[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]