Re: [PATCH] Make git revert warn the user when reverting a merge commit.
Junio C Hamano <gitster@pobox.com> writes:
Show 6 quoted lines
> 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