From: Junio C Hamano Date: Tue, 18 Apr 2023 01:05:13 +0000 (-0700) Subject: Merge branch 'pw/rebase-cleanup-merge-strategy-option-handling' X-Git-Tag: v2.41.0-rc0~76 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=3c957e6d399452897209d90fc0528a77bb093df3;p=thirdparty%2Fgit.git Merge branch 'pw/rebase-cleanup-merge-strategy-option-handling' Clean-up of the code path that deals with merge strategy option handling in "git rebase". * pw/rebase-cleanup-merge-strategy-option-handling: rebase: remove a couple of redundant strategy tests rebase -m: fix serialization of strategy options rebase -m: cleanup --strategy-option handling sequencer: use struct strvec to store merge strategy options rebase: stop reading and writing unnecessary strategy state --- 3c957e6d399452897209d90fc0528a77bb093df3 diff --cc builtin/rebase.c index 680fe3c145,511922c6fc..1ceac603c7 --- a/builtin/rebase.c +++ b/builtin/rebase.c @@@ -146,10 -142,9 +147,11 @@@ struct rebase_options .allow_empty_message = 1, \ .autosquash = -1, \ .config_autosquash = -1, \ + .rebase_merges = -1, \ + .config_rebase_merges = -1, \ .update_refs = -1, \ .config_update_refs = -1, \ + .strategy_opts = STRING_LIST_INIT_NODUP,\ } static struct replay_opts get_replay_opts(const struct rebase_options *opts) @@@ -1089,7 -1014,7 +1067,6 @@@ int cmd_rebase(int argc, const char **a struct object_id branch_base; int ignore_whitespace = 0; const char *gpg_sign = NULL; - struct string_list strategy_options = STRING_LIST_INIT_NODUP; - const char *rebase_merges = NULL; struct object_id squash_onto; char *squash_onto_name = NULL; char *keep_base_onto_name = NULL; diff --cc parse-options.h index 6f6462fdf9,2d1d4d052f..8e48efe524 --- a/parse-options.h +++ b/parse-options.h @@@ -480,7 -487,11 +489,8 @@@ int parse_opt_commits(const struct opti int parse_opt_commit(const struct option *, const char *, int); int parse_opt_tertiary(const struct option *, const char *, int); int parse_opt_string_list(const struct option *, const char *, int); + int parse_opt_strvec(const struct option *, const char *, int); int parse_opt_noop_cb(const struct option *, const char *, int); -enum parse_opt_result parse_opt_unknown_cb(struct parse_opt_ctx_t *ctx, - const struct option *, - const char *, int); int parse_opt_passthru(const struct option *, const char *, int); int parse_opt_passthru_argv(const struct option *, const char *, int); /* value is enum branch_track* */ diff --cc sequencer.c index 6985ca526a,fc6ea75895..d2c7698c48 --- a/sequencer.c +++ b/sequencer.c @@@ -696,11 -688,11 +694,11 @@@ static int do_recursive_merge(struct re o.show_rename_progress = 1; head_tree = parse_tree_indirect(head); - next_tree = next ? get_commit_tree(next) : empty_tree(r); - base_tree = base ? get_commit_tree(base) : empty_tree(r); + next_tree = next ? repo_get_commit_tree(r, next) : empty_tree(r); + base_tree = base ? repo_get_commit_tree(r, base) : empty_tree(r); - for (i = 0; i < opts->xopts_nr; i++) - parse_merge_opt(&o, opts->xopts[i]); + for (i = 0; i < opts->xopts.nr; i++) + parse_merge_opt(&o, opts->xopts.v[i]); if (!opts->strategy || !strcmp(opts->strategy, "ort")) { memset(&result, 0, sizeof(result));