Skip to content

Commit

Permalink
rebase --am: ignore rebase.rescheduleFailedExec
Browse files Browse the repository at this point in the history
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:
969de3ff0e0#commitcomment-33257187

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
dscho authored and gitster committed Jul 1, 2019
1 parent e11ff89 commit 906b639
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
10 changes: 7 additions & 3 deletions builtin/rebase.c
Original file line number Diff line number Diff line change
Expand Up @@ -834,6 +834,7 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
struct string_list strategy_options = STRING_LIST_INIT_NODUP;
struct object_id squash_onto;
char *squash_onto_name = NULL;
int reschedule_failed_exec = -1;
struct option builtin_rebase_options[] = {
OPT_STRING(0, "onto", &options.onto_name,
N_("revision"),
Expand Down Expand Up @@ -929,7 +930,7 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
OPT_BOOL(0, "root", &options.root,
N_("rebase all reachable commits up to the root(s)")),
OPT_BOOL(0, "reschedule-failed-exec",
&options.reschedule_failed_exec,
&reschedule_failed_exec,
N_("automatically re-schedule any `exec` that fails")),
OPT_END(),
};
Expand Down Expand Up @@ -1227,8 +1228,11 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
break;
}

if (options.reschedule_failed_exec && !is_interactive(&options))
die(_("--reschedule-failed-exec requires an interactive rebase"));
if (reschedule_failed_exec > 0 && !is_interactive(&options))
die(_("--reschedule-failed-exec requires "
"--exec or --interactive"));
if (reschedule_failed_exec >= 0)
options.reschedule_failed_exec = reschedule_failed_exec;

if (options.git_am_opts.argc) {
/* all am options except -q are compatible only with --am */
Expand Down
8 changes: 8 additions & 0 deletions t/t3418-rebase-continue.sh
Original file line number Diff line number Diff line change
Expand Up @@ -265,4 +265,12 @@ test_expect_success '--reschedule-failed-exec' '
test_i18ngrep "has been rescheduled" err
'

test_expect_success 'rebase.reschedulefailedexec only affects `rebase -i`' '
test_config rebase.reschedulefailedexec true &&
test_must_fail git rebase -x false HEAD^ &&
grep "^exec false" .git/rebase-merge/git-rebase-todo &&
git rebase --abort &&
git rebase HEAD^
'

test_done

0 comments on commit 906b639

Please sign in to comment.