rebase: introduce --reschedule-failed-exec
A common use case for the `--exec` option is to verify that each commit in a topic branch compiles cleanly, via `git rebase -x make <base>`. However, when an `exec` in such a rebase fails, it is not re-scheduled, which in this instance is not particularly helpful. Let's offer a flag to reschedule failed `exec` commands. Based on an idea by Paul Morelle. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
5d826e9729
commit
d421afa0c6
13
sequencer.c
13
sequencer.c
@ -158,6 +158,7 @@ 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 GIT_PATH_FUNC(rebase_path_quiet, "rebase-merge/quiet")
|
||||
static GIT_PATH_FUNC(rebase_path_reschedule_failed_exec, "rebase-merge/reschedule-failed-exec")
|
||||
|
||||
static int git_sequencer_config(const char *k, const char *v, void *cb)
|
||||
{
|
||||
@ -2362,6 +2363,9 @@ static int read_populate_opts(struct replay_opts *opts)
|
||||
opts->signoff = 1;
|
||||
}
|
||||
|
||||
if (file_exists(rebase_path_reschedule_failed_exec()))
|
||||
opts->reschedule_failed_exec = 1;
|
||||
|
||||
read_strategy_opts(opts, &buf);
|
||||
strbuf_release(&buf);
|
||||
|
||||
@ -2443,6 +2447,8 @@ int write_basic_state(struct replay_opts *opts, const char *head_name,
|
||||
write_file(rebase_path_gpg_sign_opt(), "-S%s\n", opts->gpg_sign);
|
||||
if (opts->signoff)
|
||||
write_file(rebase_path_signoff(), "--signoff\n");
|
||||
if (opts->reschedule_failed_exec)
|
||||
write_file(rebase_path_reschedule_failed_exec(), "%s", "");
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -3586,9 +3592,10 @@ static int pick_commits(struct todo_list *todo_list, struct replay_opts *opts)
|
||||
*end_of_arg = saved;
|
||||
|
||||
/* Reread the todo file if it has changed. */
|
||||
if (res)
|
||||
; /* fall through */
|
||||
else if (stat(get_todo_path(opts), &st))
|
||||
if (res) {
|
||||
if (opts->reschedule_failed_exec)
|
||||
reschedule = 1;
|
||||
} else if (stat(get_todo_path(opts), &st))
|
||||
res = error_errno(_("could not stat '%s'"),
|
||||
get_todo_path(opts));
|
||||
else if (match_stat_data(&todo_list->stat, &st)) {
|
||||
|
Reference in New Issue
Block a user