revert: Simplify and inline add_message_to_msg
commitbe33c46cda2cd74344d338150019cbabd88df12f
authorRamkumar Ramachandra <artagnon@gmail.com>
Thu, 4 Aug 2011 10:39:01 +0000 (4 16:09 +0530)
committerJunio C Hamano <gitster@pobox.com>
Thu, 4 Aug 2011 22:40:41 +0000 (4 15:40 -0700)
treee41ffae848b10a2b82af167a781921b1f9ac2272
parent5ec3118293931cf1fe8677f16449999cfbfc8b92
revert: Simplify and inline add_message_to_msg

The add_message_to_msg function has some dead code, an unclear API,
only one callsite.  While it originally intended fill up an empty
commit message with the commit object name while picking, it really
doesn't do this -- a bug introduced in v1.5.1-rc1~65^2~2 (Make
git-revert & git-cherry-pick a builtin, 2007-03-01).  Today, tests in
t3505-cherry-pick-empty.sh indicate that not filling up an empty
commit message is the desired behavior.  Re-implement and inline the
function accordingly, with a beneficial side-effect: don't dereference
a NULL pointer when the commit doesn't have a delimeter after the
header.

Helped-by: Junio C Hamano <gitster@pobox.com>
Mentored-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/revert.c