diff options
author | Junio C Hamano <gitster@pobox.com> | 2017-08-22 10:29:00 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2017-08-22 10:29:00 -0700 |
commit | 1016495a7190911b37c354f7a985278c51ae6666 (patch) | |
tree | 63d8897867229a377473b122902337658948add2 /sequencer.c | |
parent | a49794d10826ef7cc9237abcf6474cd826de1063 (diff) | |
parent | f826fb799ed06f2f9537466f6988bcabd1200ebd (diff) | |
download | git-1016495a7190911b37c354f7a985278c51ae6666.tar.gz git-1016495a7190911b37c354f7a985278c51ae6666.tar.xz |
Merge branch 'pw/sequence-rerere-autoupdate'
Commands like "git rebase" accepted the --rerere-autoupdate option
from the command line, but did not always use it. This has been
fixed.
* pw/sequence-rerere-autoupdate:
cherry-pick/revert: reject --rerere-autoupdate when continuing
cherry-pick/revert: remember --rerere-autoupdate
t3504: use test_commit
rebase -i: honor --rerere-autoupdate
rebase: honor --rerere-autoupdate
am: remember --rerere-autoupdate setting
Diffstat (limited to 'sequencer.c')
-rw-r--r-- | sequencer.c | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/sequencer.c b/sequencer.c index f5e85a398..fcceabb80 100644 --- a/sequencer.c +++ b/sequencer.c @@ -127,6 +127,7 @@ static GIT_PATH_FUNC(rebase_path_onto, "rebase-merge/onto") static GIT_PATH_FUNC(rebase_path_autostash, "rebase-merge/autostash") static GIT_PATH_FUNC(rebase_path_strategy, "rebase-merge/strategy") static GIT_PATH_FUNC(rebase_path_strategy_opts, "rebase-merge/strategy_opts") +static GIT_PATH_FUNC(rebase_path_allow_rerere_autoupdate, "rebase-merge/allow_rerere_autoupdate") static inline int is_rebase_i(const struct replay_opts *opts) { @@ -1438,7 +1439,11 @@ static int populate_opts_cb(const char *key, const char *value, void *data) else if (!strcmp(key, "options.strategy-option")) { ALLOC_GROW(opts->xopts, opts->xopts_nr + 1, opts->xopts_alloc); opts->xopts[opts->xopts_nr++] = xstrdup(value); - } else + } else if (!strcmp(key, "options.allow-rerere-auto")) + opts->allow_rerere_auto = + git_config_bool_or_int(key, value, &error_flag) ? + RERERE_AUTOUPDATE : RERERE_NOAUTOUPDATE; + else return error(_("invalid key: %s"), key); if (!error_flag) @@ -1479,6 +1484,15 @@ static int read_populate_opts(struct replay_opts *opts) free(opts->gpg_sign); opts->gpg_sign = xstrdup(buf.buf + 2); } + strbuf_reset(&buf); + } + + if (read_oneliner(&buf, rebase_path_allow_rerere_autoupdate(), 1)) { + if (!strcmp(buf.buf, "--rerere-autoupdate")) + opts->allow_rerere_auto = RERERE_AUTOUPDATE; + else if (!strcmp(buf.buf, "--no-rerere-autoupdate")) + opts->allow_rerere_auto = RERERE_NOAUTOUPDATE; + strbuf_reset(&buf); } if (file_exists(rebase_path_verbose())) @@ -1743,6 +1757,10 @@ static int save_opts(struct replay_opts *opts) "options.strategy-option", opts->xopts[i], "^$", 0); } + if (opts->allow_rerere_auto) + res |= git_config_set_in_file_gently(opts_file, "options.allow-rerere-auto", + opts->allow_rerere_auto == RERERE_AUTOUPDATE ? + "true" : "false"); return res; } |