summaryrefslogtreecommitdiff
path: root/builtin/revert.c
diff options
context:
space:
mode:
authorLibravatar Jonathan Nieder <jrnieder@gmail.com>2010-03-20 19:46:07 -0500
committerLibravatar Junio C Hamano <gitster@pobox.com>2010-03-20 20:36:11 -0700
commitbf975d379d79ab0eb9e8835af4abab4712e71dad (patch)
treebaf1f251aad5ba058643a67edba4885c1bbe9144 /builtin/revert.c
parentrevert: clarify label on conflict hunks (diff)
downloadtgif-bf975d379d79ab0eb9e8835af4abab4712e71dad.tar.xz
cherry-pick, revert: add a label for ancestor
When writing conflict hunks in ‘diff3 -m’ format, also add a label to the common ancestor. Especially in a cherry-pick, it is not immediately obvious without such a label what the common ancestor represents. git rerere does not have trouble parsing the new output and its preimage ids are unchanged since it includes its own code for recreating conflict hunks. No other code in git parses conflict hunks. Requested-by: Stefan Monnier <monnier@iro.umontreal.ca> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/revert.c')
-rw-r--r--builtin/revert.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/builtin/revert.c b/builtin/revert.c
index 5a5b72112c..1ddfac15b5 100644
--- a/builtin/revert.c
+++ b/builtin/revert.c
@@ -281,7 +281,7 @@ static int revert_or_cherry_pick(int argc, const char **argv)
{
unsigned char head[20];
struct commit *base, *next, *parent;
- const char *next_label;
+ const char *base_label, *next_label;
int i, index_fd, clean;
struct commit_message msg = { NULL, NULL, NULL, NULL, NULL };
@@ -368,6 +368,7 @@ static int revert_or_cherry_pick(int argc, const char **argv)
if (action == REVERT) {
base = commit;
+ base_label = msg.label;
next = parent;
next_label = msg.parent_label;
add_to_msg("Revert \"");
@@ -382,6 +383,7 @@ static int revert_or_cherry_pick(int argc, const char **argv)
add_to_msg(".\n");
} else {
base = parent;
+ base_label = msg.parent_label;
next = commit;
next_label = msg.label;
set_author_ident_env(msg.message);
@@ -395,6 +397,7 @@ static int revert_or_cherry_pick(int argc, const char **argv)
read_cache();
init_merge_options(&o);
+ o.ancestor = base ? base_label : "(empty tree)";
o.branch1 = "HEAD";
o.branch2 = next ? next_label : "(empty tree)";