summaryrefslogtreecommitdiff
path: root/sequencer.c
diff options
context:
space:
mode:
authorJohannes Schindelin <johannes.schindelin@gmx.de>2017-01-02 15:28:30 (GMT)
committerJunio C Hamano <gitster@pobox.com>2017-01-09 22:57:30 (GMT)
commitca6c6b45dd9c36ae3e0b4f1fc9812d1e6a8b59bc (patch)
tree0447684f39cf88b936200ef47f80e89cffdc2a62 /sequencer.c
parent796c7972c7236634655d2333333e9f871149b994 (diff)
downloadgit-ca6c6b45dd9c36ae3e0b4f1fc9812d1e6a8b59bc.zip
git-ca6c6b45dd9c36ae3e0b4f1fc9812d1e6a8b59bc.tar.gz
git-ca6c6b45dd9c36ae3e0b4f1fc9812d1e6a8b59bc.tar.bz2
sequencer (rebase -i): respect strategy/strategy_opts settings
The sequencer already has an idea about using different merge strategies. We just piggy-back on top of that, using rebase -i's own settings, when running the sequencer in interactive rebase mode. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'sequencer.c')
-rw-r--r--sequencer.c26
1 files changed, 25 insertions, 1 deletions
diff --git a/sequencer.c b/sequencer.c
index 06f7ceb..04a64cf 100644
--- a/sequencer.c
+++ b/sequencer.c
@@ -114,6 +114,8 @@ static GIT_PATH_FUNC(rebase_path_verbose, "rebase-merge/verbose")
static GIT_PATH_FUNC(rebase_path_head_name, "rebase-merge/head-name")
static GIT_PATH_FUNC(rebase_path_onto, "rebase-merge/onto")
static GIT_PATH_FUNC(rebase_path_autostash, "rebase-merge/autostash")
+static GIT_PATH_FUNC(rebase_path_strategy, "rebase-merge/strategy")
+static GIT_PATH_FUNC(rebase_path_strategy_opts, "rebase-merge/strategy_opts")
static inline int is_rebase_i(const struct replay_opts *opts)
{
@@ -1368,6 +1370,26 @@ static int populate_opts_cb(const char *key, const char *value, void *data)
return 0;
}
+static void read_strategy_opts(struct replay_opts *opts, struct strbuf *buf)
+{
+ int i;
+
+ strbuf_reset(buf);
+ if (!read_oneliner(buf, rebase_path_strategy(), 0))
+ return;
+ opts->strategy = strbuf_detach(buf, NULL);
+ if (!read_oneliner(buf, rebase_path_strategy_opts(), 0))
+ return;
+
+ opts->xopts_nr = split_cmdline(buf->buf, (const char ***)&opts->xopts);
+ for (i = 0; i < opts->xopts_nr; i++) {
+ const char *arg = opts->xopts[i];
+
+ skip_prefix(arg, "--", &arg);
+ opts->xopts[i] = xstrdup(arg);
+ }
+}
+
static int read_populate_opts(struct replay_opts *opts)
{
if (is_rebase_i(opts)) {
@@ -1381,11 +1403,13 @@ static int read_populate_opts(struct replay_opts *opts)
opts->gpg_sign = xstrdup(buf.buf + 2);
}
}
- strbuf_release(&buf);
if (file_exists(rebase_path_verbose()))
opts->verbose = 1;
+ read_strategy_opts(opts, &buf);
+ strbuf_release(&buf);
+
return 0;
}