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>

Johannes Schindelin committed Jan 2, 2017 at 16:28 UTC ca6c6b45dd9c36ae3e0b4f1fc9812d1e6a8b59bc
1 file changed +25 -1
sequencer.c
+25 -1
@@ -114,6 +114,8 @@ static GIT_PATH_FUNC(rebase_path_verbose, "rebase-merge/verbose")
114 static GIT_PATH_FUNC(rebase_path_head_name, "rebase-merge/head-name")
115 static GIT_PATH_FUNC(rebase_path_onto, "rebase-merge/onto")
116 static GIT_PATH_FUNC(rebase_path_autostash, "rebase-merge/autostash")
117 +static GIT_PATH_FUNC(rebase_path_strategy, "rebase-merge/strategy")
118 +static GIT_PATH_FUNC(rebase_path_strategy_opts, "rebase-merge/strategy_opts")
119
120 static inline int is_rebase_i(const struct replay_opts *opts)
121 {
@@ -1368,6 +1370,26 @@ static int populate_opts_cb(const char *key, const char *value, void *data)
1370 return 0;
1371 }
1372
1373 +static void read_strategy_opts(struct replay_opts *opts, struct strbuf *buf)
1374 +{
1375 + int i;
1376 +
1377 + strbuf_reset(buf);
1378 + if (!read_oneliner(buf, rebase_path_strategy(), 0))
1379 + return;
1380 + opts->strategy = strbuf_detach(buf, NULL);
1381 + if (!read_oneliner(buf, rebase_path_strategy_opts(), 0))
1382 + return;
1383 +
1384 + opts->xopts_nr = split_cmdline(buf->buf, (const char ***)&opts->xopts);
1385 + for (i = 0; i < opts->xopts_nr; i++) {
1386 + const char *arg = opts->xopts[i];
1387 +
1388 + skip_prefix(arg, "--", &arg);
1389 + opts->xopts[i] = xstrdup(arg);
1390 + }
1391 +}
1392 +
1393 static int read_populate_opts(struct replay_opts *opts)
1394 {
1395 if (is_rebase_i(opts)) {
@@ -1381,11 +1403,13 @@ static int read_populate_opts(struct replay_opts *opts)
1403 opts->gpg_sign = xstrdup(buf.buf + 2);
1404 }
1405 }
1384 - strbuf_release(&buf);
1406
1407 if (file_exists(rebase_path_verbose()))
1408 opts->verbose = 1;
1409
1410 + read_strategy_opts(opts, &buf);
1411 + strbuf_release(&buf);
1412 +
1413 return 0;
1414 }
1415