Skip to content

Commit

Permalink
rebase: add a config option to default to --reschedule-failed-exec
Browse files Browse the repository at this point in the history
It would be cumbersome to type out that option all the time, so let's
offer the convenience of a config setting: rebase.rescheduleFailedExec.

Besides, this opens the door to changing the default in a future version
of Git: it does make some sense to reschedule failed `exec` commands by
default (and if we could go back in time when the `exec` command was
invented, we probably would change that default right from the start).

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 Dec 11, 2018
1 parent d421afa commit 969de3f
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 1 deletion.
5 changes: 5 additions & 0 deletions Documentation/config/rebase.txt
Expand Up @@ -64,3 +64,8 @@ instead of:
-------------------------------------------
+
Defaults to false.

rebase.rescheduleFailedExec::
Automatically reschedule `exec` commands that failed. This only makes
sense in interactive mode (or when an `--exec` option was provided).
This is the same as specifying the `--reschedule-failed-exec` option.
5 changes: 5 additions & 0 deletions builtin/rebase.c
Expand Up @@ -677,6 +677,11 @@ static int rebase_config(const char *var, const char *value, void *data)
return 0;
}

if (!strcmp(var, "rebase.reschedulefailedexec")) {
opts->reschedule_failed_exec = git_config_bool(var, value);
return 0;
}

return git_default_config(var, value, data);
}

Expand Down
2 changes: 2 additions & 0 deletions git-legacy-rebase.sh
Expand Up @@ -99,6 +99,8 @@ case "$(git config --bool commit.gpgsign)" in
true) gpg_sign_opt=-S ;;
*) gpg_sign_opt= ;;
esac
test "$(git config --bool rebase.reschedulefailedexec)" = "true" &&
reschedule_failed_exec=--reschedule-failed-exec
. git-rebase--common

read_basic_state () {
Expand Down
7 changes: 6 additions & 1 deletion t/t3418-rebase-continue.sh
Expand Up @@ -257,7 +257,12 @@ test_expect_success 'the todo command "break" works' '
test_expect_success '--reschedule-failed-exec' '
test_when_finished "git rebase --abort" &&
test_must_fail git rebase -x false --reschedule-failed-exec HEAD^ &&
grep "^exec false" .git/rebase-merge/git-rebase-todo
grep "^exec false" .git/rebase-merge/git-rebase-todo &&
git rebase --abort &&
test_must_fail git -c rebase.rescheduleFailedExec=true \
rebase -x false HEAD^ 2>err &&
grep "^exec false" .git/rebase-merge/git-rebase-todo &&
test_i18ngrep "has been rescheduled" err
'

test_done

8 comments on commit 969de3f

@vassudanagunta
Copy link

@vassudanagunta vassudanagunta commented on 969de3f Apr 21, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dscho The --reschedule-failed-exec option is great. Thanks. But the rebase.rescheduleFailedExec .gitconfig option is useless for most people as currently implemented since it prevents users from doing non-interactive rebases. Any attempt to do so results in:

fatal: --reschedule-failed-exec requires an interactive rebase

@dscho
Copy link
Member Author

@dscho dscho commented on 969de3f Jun 3, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True. It is a pity that this was buried in my GitHub notifications and has not been discussed on the Git mailing list. Now it is too late to slip in a fix into v2.22.0, I think.

@dscho
Copy link
Member Author

@dscho dscho commented on 969de3f Jun 3, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See gitgitgadget#253. And next time, please do use a bug tracker, or even better the Git mailing list.

@dakotahawkins
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dscho I just ran in to this, and I'm glad I did because it taught me that gitgitgadget exists :)

@dscho
Copy link
Member Author

@dscho dscho commented on 969de3f Aug 3, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just ran in to this, and I'm glad I did because it taught me that gitgitgadget exists :)

:-)

@dscho
Copy link
Member Author

@dscho dscho commented on 969de3f Aug 3, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FWIW the issue reported here is slated to be fixed in Git v2.23.0, so at least it got fixed, if late.

@dakotahawkins
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm looking forward to that. I just (days ago) needed to use that feature and then yesterday had this problem happen. Looks like 2.23.0 is coming soon enough that I won't forget to uncomment the setting in my .gitconfig :)

@dscho
Copy link
Member Author

@dscho dscho commented on 969de3f Aug 4, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dakotahawkins please note that -rc0 and -rc1 are out, you can already install them (and test them, and give feedback on them 😃).

Please sign in to comment.