]> git.ipfire.org Git - thirdparty/git.git/commit - sequencer.c
rebase -i: rewrite complete_action() in C
authorAlban Gruin <alban.gruin@gmail.com>
Tue, 28 Aug 2018 12:10:36 +0000 (14:10 +0200)
committerJunio C Hamano <gitster@pobox.com>
Wed, 29 Aug 2018 20:38:18 +0000 (13:38 -0700)
commitb97e187364990fb8410355ff8b4365d0e37bbbbe
tree73e0346e20435cb289e56cf2c59e269339c74b43
parentd078c39106895b26512ca6b259d66fe64b274e1b
rebase -i: rewrite complete_action() in C

This rewrites complete_action() from shell to C.

A new mode is added to rebase--helper (`--complete-action`), as well as
a new flag (`--autosquash`).

Finally, complete_action() is stripped from git-rebase--interactive.sh.

The original complete_action() would return the code 2 when the todo
list contained no actions.  This was a special case for rebase -i and
-p; git-rebase.sh would then apply the autostash, delete the state
directory, and die with the message "Nothing to do".  This cleanup is
rewritten in C instead of returning 2.  As rebase -i no longer returns
2, the comment describing this behaviour in git-rebase.sh is updated to
reflect this change.

The message "Nothing to do" is now printed with error(), and so becomes
"error: nothing to do".  Some tests in t3404 check this value, so they
are updated to fit this change.

The first check might seem useless as we write "noop" to the todo list
if it is empty.  Actually, the todo list might contain commented
commands (ie. empty commits).  In this case, complete_action() won’t
write "noop", and will abort without starting the editor.

Signed-off-by: Alban Gruin <alban.gruin@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/rebase--helper.c
git-rebase--interactive.sh
git-rebase.sh
sequencer.c
sequencer.h
t/t3404-rebase-interactive.sh