355
free(opts->reflog_action);
356
free(opts->default_strategy);
357
free(opts->strategy);
358
- for (size_t i = 0; i < opts->xopts_nr; i++)
359
- free(opts->xopts[i]);
360
- free(opts->xopts);
358
+ strvec_clear (&opts->xopts);
359
strbuf_release(&opts->current_fixups);
360
if (opts->revs)
361
release_revisions(opts->revs);
691
next_tree = next ? get_commit_tree(next) : empty_tree(r);
692
base_tree = base ? get_commit_tree(base) : empty_tree(r);
693
696
- for (i = 0; i < opts->xopts_nr; i++)
697
- parse_merge_opt(&o, opts->xopts[i]);
694
+ for (i = 0; i < opts->xopts.nr; i++)
695
+ parse_merge_opt(&o, opts->xopts.v[i]);
696
697
if (!opts->strategy || !strcmp(opts->strategy, "ort")) {
698
memset(&result, 0, sizeof(result));
2323
commit_list_insert(base, &common);
2324
commit_list_insert(next, &remotes);
2325
res |= try_merge_command(r, opts->strategy,
2328
- opts->xopts_nr, (const char **)opts->xopts,
2326
+ opts->xopts.nr, opts->xopts.v,
2327
common, oid_to_hex(&head), remotes);
2328
free_commit_list(common);
2329
free_commit_list(remotes);
2896
else if (!strcmp(key, "options.gpg-sign"))
2897
git_config_string_dup(&opts->gpg_sign, key, value);
2898
else if (!strcmp(key, "options.strategy-option")) {
2901
- ALLOC_GROW(opts->xopts, opts->xopts_nr + 1, opts->xopts_alloc);
2902
- opts->xopts[opts->xopts_nr++] = xstrdup(value);
2899
+ strvec_push(&opts->xopts, value);
2900
} else if (!strcmp(key, "options.allow-rerere-auto"))
2901
opts->allow_rerere_auto =
2902
git_config_bool_or_int(key, value, &error_flag) ?
2917
{
2918
int i;
2919
int count;
2920
+ const char **argv;
2921
char *strategy_opts_string = raw_opts;
2922
2923
if (*strategy_opts_string == ' ')
2924
strategy_opts_string++;
2925
2928
- count = split_cmdline(strategy_opts_string,
2929
- (const char ***)&opts->xopts);
2926
+ count = split_cmdline(strategy_opts_string, &argv);
2927
if (count < 0)
2928
die(_("could not split '%s': %s"), strategy_opts_string,
2929
split_cmdline_strerror(count));
2933
- opts->xopts_nr = count;
2934
- for (i = 0; i < opts->xopts_nr; i++) {
2935
- const char *arg = opts->xopts[i];
2930
+ for (i = 0; i < count; i++) {
2931
+ const char *arg = argv[i];
2932
2933
skip_prefix(arg, "--", &arg);
2938
- opts->xopts[i] = xstrdup(arg);
2934
+ strvec_push(&opts->xopts, arg);
2935
}
2936
+ free(argv);
2937
}
2938
2939
static void read_strategy_opts(struct replay_opts *opts, struct strbuf *buf)
3052
int i;
3053
struct strbuf buf = STRBUF_INIT;
3054
3058
- for (i = 0; i < opts->xopts_nr; ++i)
3059
- strbuf_addf(&buf, " --%s", opts->xopts[i]);
3055
+ for (i = 0; i < opts->xopts.nr; ++i)
3056
+ strbuf_addf(&buf, " --%s", opts->xopts.v[i]);
3057
3058
write_file(rebase_path_strategy_opts(), "%s\n", buf.buf);
3059
strbuf_release(&buf);
3077
write_file(rebase_path_verbose(), "%s", "");
3078
if (opts->strategy)
3079
write_file(rebase_path_strategy(), "%s\n", opts->strategy);
3083
- if (opts->xopts_nr > 0)
3080
+ if (opts->xopts.nr > 0)
3081
write_strategy_opts(opts);
3082
3083
if (opts->allow_rerere_auto == RERERE_AUTOUPDATE)
3461
if (opts->gpg_sign)
3462
res |= git_config_set_in_file_gently(opts_file,
3463
"options.gpg-sign", opts->gpg_sign);
3467
- if (opts->xopts) {
3468
- int i;
3469
- for (i = 0; i < opts->xopts_nr; i++)
3470
- res |= git_config_set_multivar_in_file_gently(opts_file,
3471
- "options.strategy-option",
3472
- opts->xopts[i], "^$", 0);
3473
- }
3464
+ for (size_t i = 0; i < opts->xopts.nr; i++)
3465
+ res |= git_config_set_multivar_in_file_gently(opts_file,
3466
+ "options.strategy-option",
3467
+ opts->xopts.v[i], "^$", 0);
3468
if (opts->allow_rerere_auto)
3469
res |= git_config_set_in_file_gently(opts_file,
3470
"options.allow-rerere-auto",
3874
struct commit *head_commit, *merge_commit, *i;
3875
struct commit_list *bases, *j;
3876
struct commit_list *to_merge = NULL, **tail = &to_merge;
3883
- const char *strategy = !opts->xopts_nr &&
3877
+ const char *strategy = !opts->xopts.nr &&
3878
(!opts->strategy ||
3879
!strcmp(opts->strategy, "recursive") ||
3880
!strcmp(opts->strategy, "ort")) ?
4057
strvec_push(&cmd.args, "octopus");
4058
else {
4059
strvec_push(&cmd.args, strategy);
4066
- for (k = 0; k < opts->xopts_nr; k++)
4060
+ for (k = 0; k < opts->xopts.nr; k++)
4061
strvec_pushf(&cmd.args,
4068
- "-X%s", opts->xopts[k]);
4062
+ "-X%s", opts->xopts.v[k]);
4063
}
4064
if (!(flags & TODO_EDIT_MERGE_MSG))
4065
strvec_push(&cmd.args, "--no-edit");