From: Junio C Hamano Date: Sun, 21 Dec 2008 22:38:53 GMT Subject: Re: [PATCH] Make git revert warn the user when reverting a merge commit. Message-ID: <7vhc4xkvb6.fsf@gitster.siamese.dyndns.org> In-Reply-To: <7vprjlkwbb.fsf@gitster.siamese.dyndns.org> Junio C Hamano writes: > Ok, so here is Robin's patch with a bit of rewording. I want to have > something usable now, so that I can tag -rc4 and still have time left > for sipping my Caipirinha in the evening ;-) > ... > + add_to_msg(",\nreverting damages made to %s"); > + add_to_msg(sha1_to_hex(parent->object.sha1)); Crap. Scratch that. Obviously I should have done this: diff --git a/builtin-revert.c b/builtin-revert.c index 4038b41..c188150 100644 --- a/builtin-revert.c +++ b/builtin-revert.c @@ -352,6 +352,11 @@ static int revert_or_cherry_pick(int argc, const char **argv) add_to_msg(oneline_body + 1); add_to_msg("\"\n\nThis reverts commit "); add_to_msg(sha1_to_hex(commit->object.sha1)); + + if (commit->parents->next) { + add_to_msg(",\nreverting damages made to "); + add_to_msg(sha1_to_hex(parent->object.sha1)); + } add_to_msg(".\n"); } else { base = parent; -- 1.6.1.rc3.72.gf4bf6