git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: "Boyd Stephen Smith Jr." <bss@iguanasuicide.net>
Cc: Robin Rosenberg <robin.rosenberg.lists@dewire.com>, git@vger.kernel.org
Subject: Re: [PATCH] Make git revert warn the user when reverting a merge commit.
Date: Sun, 21 Dec 2008 14:17:12 -0800	[thread overview]
Message-ID: <7vprjlkwbb.fsf@gitster.siamese.dyndns.org> (raw)
In-Reply-To: <200812211513.26808.bss@iguanasuicide.net> (Boyd Stephen Smith, Jr.'s message of "Sun, 21 Dec 2008 15:13:22 -0600")

From: Robin Rosenberg <robin.rosenberg.lists@dewire.com>
Subject: git-revert: record the parent against which a revert was made

As described in Documentation/howto/revert-a-faulty-merge.txt, re-merging
from a previously reverted a merge of a side branch may need a revert of
the revert beforehand.  Record against which parent the revert was made in
the commit, so that later the user can figure out what went on.

[jc: original had the logic in the message reversed, so I tweaked it.]

Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
  "Boyd Stephen Smith Jr." <bss@iguanasuicide.net> writes:

  > I still think the parent we are reverting to should be mentioned in the 
  > automatically generated commit message, even if it is the first parent.  Even 
  > if it is decided to elide that information for the first parent, I agree 
  > that, at least for now, the "-m" should still be required when reverting a 
  > merge commit.

  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 ;-)

  I think we later _could_ use this information inside ancestry traversal
  made while computing the merge base in such a way to eliminate the
  necessity of the "revert of the revert".  When we see a message that
  records a revert of a merge, we keep a mental note of it, and when we
  encounter such a merge during the ancestry traversal, we pretend as if
  the merge never happened (i.e. instead we traverse only the named
  parent).

  But that needs more thought, and we do not have to do that now.

 builtin-revert.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git c/builtin-revert.c w/builtin-revert.c
index 4038b41..fae0fe8 100644
--- c/builtin-revert.c
+++ w/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 %s");
+			add_to_msg(sha1_to_hex(parent->object.sha1));
+		}
 		add_to_msg(".\n");
 	} else {
 		base = parent;

  reply	other threads:[~2008-12-21 22:18 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-19  2:39 [PATCH] Make git revert warn the user when reverting a merge commit Boyd Stephen Smith Jr.
2008-12-19  2:57 ` Johannes Schindelin
2008-12-19  3:03   ` Junio C Hamano
2008-12-19  3:29     ` Boyd Stephen Smith Jr.
2008-12-19  3:55       ` Jay Soffian
2008-12-19  5:54         ` Boyd Stephen Smith Jr.
2008-12-19  6:35           ` Junio C Hamano
2008-12-19 18:07       ` Alan
2008-12-19  3:24   ` Boyd Stephen Smith Jr.
2008-12-20  7:08 ` Robin Rosenberg
2008-12-20 22:54   ` Boyd Stephen Smith Jr.
2008-12-20 23:31     ` Robin Rosenberg
2008-12-21  2:37       ` Junio C Hamano
2008-12-21  3:11         ` Boyd Stephen Smith Jr.
2008-12-21 10:09           ` Robin Rosenberg
2008-12-21 10:59             ` Junio C Hamano
2008-12-21 19:59             ` Boyd Stephen Smith Jr.
2008-12-21 20:23               ` Junio C Hamano
2008-12-21 21:13                 ` Boyd Stephen Smith Jr.
2008-12-21 22:17                   ` Junio C Hamano [this message]
2008-12-21 22:38                     ` Junio C Hamano
2008-12-21 22:40                     ` Robin Rosenberg
2008-12-21 22:46                       ` Junio C Hamano
2008-12-21 22:56                         ` Robin Rosenberg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7vprjlkwbb.fsf@gitster.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=bss@iguanasuicide.net \
    --cc=git@vger.kernel.org \
    --cc=robin.rosenberg.lists@dewire.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).