rebase --am: ignore rebase.rescheduleFailedExec

The `exec` command is specific to the interactive backend, therefore it does not make sense for non-interactive rebases to heed that config setting. We still want to error out if a non-interactive rebase is started with `--reschedule-failed-exec`, of course. Reported by Vas Sudanagunta via: https://github.com/git/git/commit/969de3ff0e0#commitcomment-33257187 Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Johannes Schindelin committed Jul 1, 2019 at 04:58 UTC 906b63942ac7f0ff904228b03d5dbe1edc59f0fe
2 files changed +15 -3
builtin/rebase.c
+7 -3
@@ -834,6 +834,7 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
834 struct string_list strategy_options = STRING_LIST_INIT_NODUP;
835 struct object_id squash_onto;
836 char *squash_onto_name = NULL;
837 + int reschedule_failed_exec = -1;
838 struct option builtin_rebase_options[] = {
839 OPT_STRING(0, "onto", &options.onto_name,
840 N_("revision"),
@@ -929,7 +930,7 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
930 OPT_BOOL(0, "root", &options.root,
931 N_("rebase all reachable commits up to the root(s)")),
932 OPT_BOOL(0, "reschedule-failed-exec",
932 - &options.reschedule_failed_exec,
933 + &reschedule_failed_exec,
934 N_("automatically re-schedule any `exec` that fails")),
935 OPT_END(),
936 };
@@ -1227,8 +1228,11 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
1228 break;
1229 }
1230
1230 - if (options.reschedule_failed_exec && !is_interactive(&options))
1231 - die(_("--reschedule-failed-exec requires an interactive rebase"));
1231 + if (reschedule_failed_exec > 0 && !is_interactive(&options))
1232 + die(_("--reschedule-failed-exec requires "
1233 + "--exec or --interactive"));
1234 + if (reschedule_failed_exec >= 0)
1235 + options.reschedule_failed_exec = reschedule_failed_exec;
1236
1237 if (options.git_am_opts.argc) {
1238 /* all am options except -q are compatible only with --am */
t/t3418-rebase-continue.sh
+8
@@ -265,4 +265,12 @@ test_expect_success '--reschedule-failed-exec' '
265 test_i18ngrep "has been rescheduled" err
266 '
267
268 +test_expect_success 'rebase.reschedulefailedexec only affects `rebase -i`' '
269 + test_config rebase.reschedulefailedexec true &&
270 + test_must_fail git rebase -x false HEAD^ &&
271 + grep "^exec false" .git/rebase-merge/git-rebase-todo &&
272 + git rebase --abort &&
273 + git rebase HEAD^
274 +'
275 +
276 test_done