Re: [PATCH 02/17] revert: Inline add_message_to_msg function
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Jul 19, 2011, 16:52 UTC
- Message-ID
- <7vfwm29pqz.fsf@alter.siamese.dyndns.org>
- In-Reply-To
- <CALkWK0mmPeYawqF-Dd3Sv_0qYjfYA-36POengYupfjwNBRDj-g@mail.gmail.com>
Ramkumar Ramachandra <artagnon@gmail.com> writes:
Show 6 quoted lines
> 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...
Show 17 quoted lines
> @@ -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.Show 7 quoted lines
> + 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));