Skip to content

Commit 66afa24

Browse files
dschogitster
authored andcommitted
sequencer: report when noop has an argument
The noop command cannot accept any argument, but we never told the user about any bogus argument. Fix that. while at it, mention clearly when an argument is required but missing (for commands *other* than noop). Signed-off-by: Johannes Schindelin <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 5f8f927 commit 66afa24

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

sequencer.c

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1261,18 +1261,23 @@ static int parse_insn_line(struct todo_item *item, const char *bol, char *eol)
12611261
if (i >= TODO_COMMENT)
12621262
return -1;
12631263

1264+
/* Eat up extra spaces/ tabs before object name */
1265+
padding = strspn(bol, " \t");
1266+
bol += padding;
1267+
12641268
if (item->command == TODO_NOOP) {
1269+
if (bol != eol)
1270+
return error(_("%s does not accept arguments: '%s'"),
1271+
command_to_string(item->command), bol);
12651272
item->commit = NULL;
12661273
item->arg = bol;
12671274
item->arg_len = eol - bol;
12681275
return 0;
12691276
}
12701277

1271-
/* Eat up extra spaces/ tabs before object name */
1272-
padding = strspn(bol, " \t");
12731278
if (!padding)
1274-
return -1;
1275-
bol += padding;
1279+
return error(_("missing arguments for %s"),
1280+
command_to_string(item->command));
12761281

12771282
if (item->command == TODO_EXEC) {
12781283
item->commit = NULL;

0 commit comments

Comments
 (0)