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 <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Johannes Schindelin committed Dec 23, 2017 at 00:55 UTC 66afa24fb36f15c49aed76be2f04bd23dd0e55c8
1 file changed +9 -4
sequencer.c
+9 -4
@@ -1261,18 +1261,23 @@ static int parse_insn_line(struct todo_item *item, const char *bol, char *eol)
1261 if (i >= TODO_COMMENT)
1262 return -1;
1263
1264 + /* Eat up extra spaces/ tabs before object name */
1265 + padding = strspn(bol, " \t");
1266 + bol += padding;
1267 +
1268 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);
1272 item->commit = NULL;
1273 item->arg = bol;
1274 item->arg_len = eol - bol;
1275 return 0;
1276 }
1277
1271 - /* Eat up extra spaces/ tabs before object name */
1272 - padding = strspn(bol, " \t");
1278 if (!padding)
1274 - return -1;
1275 - bol += padding;
1279 + return error(_("missing arguments for %s"),
1280 + command_to_string(item->command));
1281
1282 if (item->command == TODO_EXEC) {
1283 item->commit = NULL;