Re: [PATCH 02/17] revert: Inline add_message_to_msg function

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

 



Ramkumar Ramachandra <artagnon@xxxxxxxxx> writes:

> The strstr(msg.message, "\n\n") actually stops after the 0 in the
> committer line.  It's trying to find out where the commit message
> actually begins.  I even created a commit using commit-tree (not using
> porcelain), but it's impossible to find a msg.message that doesn't
> have a "\n\n" -- even one with an empty commit message looks like:
> ...

... with current git, sure, but I think the code to check for "just in
case we didn't find \n\n" is there because prehistoric versions of git
could write such a commit object.

Hence...

> @@ -462,11 +449,22 @@ static int do_pick_commit(void)
>                 }
>                 strbuf_addstr(&msgbuf, ".\n");
>         } else {
> +               const char *p;
> +
>                 base = parent;
>                 base_label = msg.parent_label;
>                 next = commit;
>                 next_label = msg.label;
> +
> +               /*
> +                * Append the commit log message to msgbuf; it starts
> +                * after the tree, parent, author, committer
> +                * information followed by "\n\n".
> +                */
> +               p = strstr(msg.message, "\n\n");

I would prefer to have if (p) { ... } around the two lines below.

> +               p += 2;
> +               strbuf_addstr(&msgbuf, p);
> +
>                 if (no_replay) {
>                         strbuf_addstr(&msgbuf, "(cherry picked from commit ");
>                         strbuf_addstr(&msgbuf,
> sha1_to_hex(commit->object.sha1));
--
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]