Skip to content

Commit 78da129

Browse files
committed
sequencer (rebase -i): differentiate between comments and 'noop'
In the upcoming patch, we will support rebase -i's progress reporting. The progress skips comments but counts 'noop's. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
1 parent 90fdadf commit 78da129

1 file changed

Lines changed: 8 additions & 6 deletions

File tree

sequencer.c

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -681,7 +681,8 @@ enum todo_command {
681681
TODO_SQUASH,
682682
TODO_EXEC,
683683
TODO_NOOP,
684-
TODO_DROP
684+
TODO_DROP,
685+
TODO_COMMENT
685686
};
686687

687688
static struct {
@@ -696,12 +697,13 @@ static struct {
696697
{ 's', "squash" },
697698
{ 'x', "exec" },
698699
{ 0, "noop" },
699-
{ 'd', "drop" }
700+
{ 'd', "drop" },
701+
{ 0, NULL }
700702
};
701703

702704
static const char *command_to_string(const enum todo_command command)
703705
{
704-
if (command >= 0 && command < ARRAY_SIZE(todo_command_info))
706+
if (command >= 0 && command < TODO_COMMENT)
705707
return todo_command_info[command].str;
706708
die("Unknown command: %d", command);
707709
}
@@ -1136,14 +1138,14 @@ static int parse_insn_line(struct todo_item *item,
11361138
int i, saved, status, padding;
11371139

11381140
if (bol == eol || *bol == '\r' || *bol == comment_line_char) {
1139-
item->command = TODO_NOOP;
1141+
item->command = TODO_COMMENT;
11401142
item->commit = NULL;
11411143
item->arg = bol;
11421144
item->arg_len = eol - bol;
11431145
return 0;
11441146
}
11451147

1146-
for (i = 0; i < ARRAY_SIZE(todo_command_info); i++)
1148+
for (i = 0; i < TODO_COMMENT; i++)
11471149
if (skip_prefix(bol, todo_command_info[i].str, &bol)) {
11481150
item->command = i;
11491151
break;
@@ -1153,7 +1155,7 @@ static int parse_insn_line(struct todo_item *item,
11531155
item->command = i;
11541156
break;
11551157
}
1156-
if (i >= ARRAY_SIZE(todo_command_info))
1158+
if (i >= TODO_COMMENT)
11571159
return error("Invalid command: %.*s", (int)(eol - bol), bol);
11581160

11591161
if (item->command == TODO_NOOP) {

0 commit comments

Comments
 (0)