Skip to content

Commit 0377ac9

Browse files
committed
Merge branch 'ab/rebase-no-reschedule-failed-exec'
"git rebase --[no-]reschedule-failed-exec" did not work well with its configuration variable, which has been corrected. * ab/rebase-no-reschedule-failed-exec: rebase: don't override --no-reschedule-failed-exec with config rebase tests: camel-case rebase.rescheduleFailedExec consistently
2 parents 5a357fa + e5b32bf commit 0377ac9

File tree

3 files changed

+38
-2
lines changed

3 files changed

+38
-2
lines changed

Documentation/git-rebase.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -617,6 +617,14 @@ See also INCOMPATIBLE OPTIONS below.
617617
--no-reschedule-failed-exec::
618618
Automatically reschedule `exec` commands that failed. This only makes
619619
sense in interactive mode (or when an `--exec` option was provided).
620+
+
621+
Even though this option applies once a rebase is started, it's set for
622+
the whole rebase at the start based on either the
623+
`rebase.rescheduleFailedExec` configuration (see linkgit:git-config[1]
624+
or "CONFIGURATION" below) or whether this option is
625+
provided. Otherwise an explicit `--no-reschedule-failed-exec` at the
626+
start would be overridden by the presence of
627+
`rebase.rescheduleFailedExec=true` configuration.
620628

621629
INCOMPATIBLE OPTIONS
622630
--------------------

sequencer.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,7 @@ static GIT_PATH_FUNC(rebase_path_strategy, "rebase-merge/strategy")
164164
static GIT_PATH_FUNC(rebase_path_strategy_opts, "rebase-merge/strategy_opts")
165165
static GIT_PATH_FUNC(rebase_path_allow_rerere_autoupdate, "rebase-merge/allow_rerere_autoupdate")
166166
static GIT_PATH_FUNC(rebase_path_reschedule_failed_exec, "rebase-merge/reschedule-failed-exec")
167+
static GIT_PATH_FUNC(rebase_path_no_reschedule_failed_exec, "rebase-merge/no-reschedule-failed-exec")
167168
static GIT_PATH_FUNC(rebase_path_drop_redundant_commits, "rebase-merge/drop_redundant_commits")
168169
static GIT_PATH_FUNC(rebase_path_keep_redundant_commits, "rebase-merge/keep_redundant_commits")
169170

@@ -2868,6 +2869,8 @@ static int read_populate_opts(struct replay_opts *opts)
28682869

28692870
if (file_exists(rebase_path_reschedule_failed_exec()))
28702871
opts->reschedule_failed_exec = 1;
2872+
else if (file_exists(rebase_path_no_reschedule_failed_exec()))
2873+
opts->reschedule_failed_exec = 0;
28712874

28722875
if (file_exists(rebase_path_drop_redundant_commits()))
28732876
opts->drop_redundant_commits = 1;
@@ -2968,6 +2971,8 @@ int write_basic_state(struct replay_opts *opts, const char *head_name,
29682971
write_file(rebase_path_ignore_date(), "%s", "");
29692972
if (opts->reschedule_failed_exec)
29702973
write_file(rebase_path_reschedule_failed_exec(), "%s", "");
2974+
else
2975+
write_file(rebase_path_no_reschedule_failed_exec(), "%s", "");
29712976

29722977
return 0;
29732978
}

t/t3418-rebase-continue.sh

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -282,12 +282,35 @@ test_expect_success '--reschedule-failed-exec' '
282282
test_i18ngrep "has been rescheduled" err
283283
'
284284

285-
test_expect_success 'rebase.reschedulefailedexec only affects `rebase -i`' '
286-
test_config rebase.reschedulefailedexec true &&
285+
test_expect_success 'rebase.rescheduleFailedExec only affects `rebase -i`' '
286+
test_config rebase.rescheduleFailedExec true &&
287287
test_must_fail git rebase -x false HEAD^ &&
288288
grep "^exec false" .git/rebase-merge/git-rebase-todo &&
289289
git rebase --abort &&
290290
git rebase HEAD^
291291
'
292292

293+
test_expect_success 'rebase.rescheduleFailedExec=true & --no-reschedule-failed-exec' '
294+
test_when_finished "git rebase --abort" &&
295+
test_config rebase.rescheduleFailedExec true &&
296+
test_must_fail git rebase -x false --no-reschedule-failed-exec HEAD~2 &&
297+
test_must_fail git rebase --continue 2>err &&
298+
! grep "has been rescheduled" err
299+
'
300+
301+
test_expect_success 'new rebase.rescheduleFailedExec=true setting in an ongoing rebase is ignored' '
302+
test_when_finished "git rebase --abort" &&
303+
test_must_fail git rebase -x false HEAD~2 &&
304+
test_config rebase.rescheduleFailedExec true &&
305+
test_must_fail git rebase --continue 2>err &&
306+
! grep "has been rescheduled" err
307+
'
308+
309+
test_expect_success 'there is no --no-reschedule-failed-exec in an ongoing rebase' '
310+
test_when_finished "git rebase --abort" &&
311+
test_must_fail git rebase -x false HEAD~2 &&
312+
test_expect_code 129 git rebase --continue --no-reschedule-failed-exec &&
313+
test_expect_code 129 git rebase --edit-todo --no-reschedule-failed-exec
314+
'
315+
293316
test_done

0 commit comments

Comments
 (0)