diff options
author | Elijah Newren <newren@gmail.com> | 2018-06-27 08:48:04 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2018-06-27 12:25:12 -0700 |
commit | 0060041df1b0873b36aacfae8e579999bcc27f39 (patch) | |
tree | a17188b62c451d4311b5a71f2886e8169d715dc1 /sequencer.c | |
parent | t3418: add testcase showing problems with rebase -i and strategy options (diff) | |
download | tgif-0060041df1b0873b36aacfae8e579999bcc27f39.tar.xz |
Fix use of strategy options with interactive rebases
git-rebase.sh wrote strategy options to .git/rebase/merge/strategy_opts
in the following format:
'--ours' '--renormalize'
Note the double spaces.
git-rebase--interactive uses sequencer.c to parse that file, and
sequencer.c used split_cmdline() to get the individual strategy options.
After splitting, sequencer.c prefixed each "option" with a double dash,
so, concatenating all its options would result in:
-- --ours -- --renormalize
So, when it ended up calling try_merge_strategy(), that in turn would run
git merge-$strategy -- --ours -- --renormalize $merge_base -- $head $remote
instead of the expected/desired
git merge-$strategy --ours --renormalize $merge_base -- $head $remote
Remove the extra spaces so that when it goes through split_cmdline() we end
up with the desired command line.
Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'sequencer.c')
-rw-r--r-- | sequencer.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/sequencer.c b/sequencer.c index f9d1001dee..96f9630856 100644 --- a/sequencer.c +++ b/sequencer.c @@ -2000,6 +2000,7 @@ static int populate_opts_cb(const char *key, const char *value, void *data) static void read_strategy_opts(struct replay_opts *opts, struct strbuf *buf) { int i; + char *strategy_opts_string; strbuf_reset(buf); if (!read_oneliner(buf, rebase_path_strategy(), 0)) @@ -2008,7 +2009,11 @@ static void read_strategy_opts(struct replay_opts *opts, struct strbuf *buf) if (!read_oneliner(buf, rebase_path_strategy_opts(), 0)) return; - opts->xopts_nr = split_cmdline(buf->buf, (const char ***)&opts->xopts); + strategy_opts_string = buf->buf; + if (*strategy_opts_string == ' ') + strategy_opts_string++; + opts->xopts_nr = split_cmdline(strategy_opts_string, + (const char ***)&opts->xopts); for (i = 0; i < opts->xopts_nr; i++) { const char *arg = opts->xopts[i]; |