]> git.ipfire.org Git - thirdparty/git.git/commitdiff
Merge branch 'pw/rebase-cleanup-merge-strategy-option-handling'
authorJunio C Hamano <gitster@pobox.com>
Tue, 18 Apr 2023 01:05:13 +0000 (18:05 -0700)
committerJunio C Hamano <gitster@pobox.com>
Tue, 18 Apr 2023 01:05:13 +0000 (18:05 -0700)
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

1  2 
builtin/rebase.c
builtin/revert.c
parse-options-cb.c
parse-options.h
sequencer.c

index 680fe3c1453c7e377241c62b51e73c560fb71770,511922c6fcba10b845f9d27f197819ca903ea91c..1ceac603c724aabd482b15680b2df195d3039622
@@@ -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;
Simple merge
Simple merge
diff --cc parse-options.h
index 6f6462fdf925d2694bf3eea075d9cec706283c8f,2d1d4d052ffe105b8795f57d88d16239dd2f13c5..8e48efe524882a6dcd4c854de6fcdbe0ef76acda
@@@ -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 6985ca526aef96a0814cc35beca4311689a9d1c5,fc6ea75895fa85c6605c74157687c3ab697fce98..d2c7698c48ceb92f1bd1ceb03496033cc78f35a0
@@@ -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));