summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: c674d05)
raw | patch | inline | side by side (parent: c674d05)
author | Christian Couder <chriscool@tuxfamily.org> | |
Wed, 31 Mar 2010 19:22:08 +0000 (21:22 +0200) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Thu, 1 Apr 2010 18:14:11 +0000 (11:14 -0700) |
This patch makes it possible to use a different merge strategy when
cherry-picking. This is usefull mainly for debugging purposes as it
allows to see if some failures are caused by the merge strategy used or
not.
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
cherry-picking. This is usefull mainly for debugging purposes as it
allows to see if some failures are caused by the merge strategy used or
not.
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/revert.c | patch | blob | history |
diff --git a/builtin/revert.c b/builtin/revert.c
index f4ad0fc971bdbd5d372b74dbe4afbff07ddcc6f8..b70f4b0af364caa597ab24630fc43fb41438ca2c 100644 (file)
--- a/builtin/revert.c
+++ b/builtin/revert.c
static int allow_rerere_auto;
static const char *me;
+static const char *strategy;
#define GIT_REFLOG_ACTION "GIT_REFLOG_ACTION"
OPT_BOOLEAN('s', "signoff", &signoff, "add Signed-off-by:"),
OPT_INTEGER('m', "mainline", &mainline, "parent number"),
OPT_RERERE_AUTOUPDATE(&allow_rerere_auto),
+ OPT_STRING(0, "strategy", &strategy, "strategy", "merge strategy"),
OPT_END(),
};
}
}
- do_recursive_merge(base, next, base_label, next_label,
- head, &msgbuf, defmsg);
+ if (!strategy || !strcmp(strategy, "recursive") || action == REVERT)
+ do_recursive_merge(base, next, base_label, next_label,
+ head, &msgbuf, defmsg);
+ else {
+ int res;
+ struct commit_list *common = NULL;
+ struct commit_list *remotes = NULL;
+ write_message(&msgbuf, defmsg);
+ commit_list_insert(base, &common);
+ commit_list_insert(next, &remotes);
+ res = try_merge_command(strategy, common,
+ sha1_to_hex(head), remotes);
+ free_commit_list(common);
+ free_commit_list(remotes);
+ if (res) {
+ fprintf(stderr, "Automatic %s with strategy %s failed.%s\n",
+ me, strategy, help_msg(commit_name));
+ rerere(allow_rerere_auto);
+ exit(1);
+ }
+ }
/*
*