sequencer (rebase -i): implement the 'drop' command

The parsing part of a 'drop' command is almost identical to parsing a
'pick', while the operation is the same as that of a 'noop'.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
This commit is contained in:
Johannes Schindelin
2016-04-13 15:18:29 +02:00
parent bda2de89c1
commit 17facd36e9

View File

@@ -770,7 +770,8 @@ enum todo_command {
/* commands that do something else than handling a single commit */
TODO_EXEC,
/* commands that do nothing but are counted for reporting progress */
TODO_NOOP
TODO_NOOP,
TODO_DROP
};
static struct {
@@ -784,7 +785,8 @@ static struct {
{ 'f', "fixup" },
{ 's', "squash" },
{ 'x', "exec" },
{ 0, "noop" }
{ 0, "noop" },
{ 'd', "drop" }
};
static const char *command_to_string(const enum todo_command command)
@@ -1302,7 +1304,7 @@ static int parse_insn_buffer(char *buf, struct todo_list *todo_list)
else if (is_fixup(item->command))
return error("Cannot '%s' without a previous commit",
command_to_string(item->command));
else if (item->command != TODO_NOOP)
else if (item->command < TODO_NOOP)
fixup_okay = 1;
p = *eol ? eol + 1 : eol;
}
@@ -1801,7 +1803,7 @@ static enum todo_command peek_command(struct todo_list *todo_list, int offset)
int i;
for (i = todo_list->current + offset; i < todo_list->nr; i++)
if (todo_list->items[i].command != TODO_NOOP)
if (todo_list->items[i].command < TODO_NOOP)
return todo_list->items[i].command;
return -1;
@@ -1934,7 +1936,7 @@ static int pick_commits(struct todo_list *todo_list, struct replay_opts *opts)
res = do_exec(item->arg);
*end_of_arg = saved;
}
else if (item->command != TODO_NOOP)
else if (item->command < TODO_NOOP)
return error("Unknown command %d", item->command);
todo_list->current++;