From b97e187364990fb8410355ff8b4365d0e37bbbbe Mon Sep 17 00:00:00 2001 From: Alban Gruin Date: Tue, 28 Aug 2018 14:10:36 +0200 Subject: rebase -i: rewrite complete_action() in C MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Signed-off-by: Junio C Hamano --- sequencer.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'sequencer.h') diff --git a/sequencer.h b/sequencer.h index fcbcd246c2..d58766c6d7 100644 --- a/sequencer.h +++ b/sequencer.h @@ -92,6 +92,10 @@ int transform_todos(unsigned flags); enum missing_commit_check_level get_missing_commit_check_level(void); int check_todo_list(void); int skip_unnecessary_picks(struct object_id *output_oid); +int complete_action(struct replay_opts *opts, unsigned flags, + const char *shortrevisions, const char *onto_name, + const char *onto, const char *orig_head, const char *cmd, + unsigned autosquash); int rearrange_squash(void); extern const char sign_off_header[]; -- cgit v1.2.3