Skip to content

Commit beaeb24

Browse files
committed
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: git@969de3ff0e0#commitcomment-33257187 Signed-off-by: Johannes Schindelin <[email protected]>
1 parent e11ff89 commit beaeb24

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

builtin/rebase.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -834,6 +834,7 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
834834
struct string_list strategy_options = STRING_LIST_INIT_NODUP;
835835
struct object_id squash_onto;
836836
char *squash_onto_name = NULL;
837+
int reschedule_failed_exec = -1;
837838
struct option builtin_rebase_options[] = {
838839
OPT_STRING(0, "onto", &options.onto_name,
839840
N_("revision"),
@@ -929,7 +930,7 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
929930
OPT_BOOL(0, "root", &options.root,
930931
N_("rebase all reachable commits up to the root(s)")),
931932
OPT_BOOL(0, "reschedule-failed-exec",
932-
&options.reschedule_failed_exec,
933+
&reschedule_failed_exec,
933934
N_("automatically re-schedule any `exec` that fails")),
934935
OPT_END(),
935936
};
@@ -1227,8 +1228,11 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
12271228
break;
12281229
}
12291230

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;
12321236

12331237
if (options.git_am_opts.argc) {
12341238
/* all am options except -q are compatible only with --am */

t/t3418-rebase-continue.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,4 +265,12 @@ test_expect_success '--reschedule-failed-exec' '
265265
test_i18ngrep "has been rescheduled" err
266266
'
267267

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+
268276
test_done

0 commit comments

Comments
 (0)