зеркало из https://github.com/microsoft/git.git
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>
This commit is contained in:
Родитель
5f8f927710
Коммит
66afa24fb3
13
sequencer.c
13
sequencer.c
|
@ -1261,18 +1261,23 @@ static int parse_insn_line(struct todo_item *item, const char *bol, char *eol)
|
||||||
if (i >= TODO_COMMENT)
|
if (i >= TODO_COMMENT)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
/* Eat up extra spaces/ tabs before object name */
|
||||||
|
padding = strspn(bol, " \t");
|
||||||
|
bol += padding;
|
||||||
|
|
||||||
if (item->command == TODO_NOOP) {
|
if (item->command == TODO_NOOP) {
|
||||||
|
if (bol != eol)
|
||||||
|
return error(_("%s does not accept arguments: '%s'"),
|
||||||
|
command_to_string(item->command), bol);
|
||||||
item->commit = NULL;
|
item->commit = NULL;
|
||||||
item->arg = bol;
|
item->arg = bol;
|
||||||
item->arg_len = eol - bol;
|
item->arg_len = eol - bol;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Eat up extra spaces/ tabs before object name */
|
|
||||||
padding = strspn(bol, " \t");
|
|
||||||
if (!padding)
|
if (!padding)
|
||||||
return -1;
|
return error(_("missing arguments for %s"),
|
||||||
bol += padding;
|
command_to_string(item->command));
|
||||||
|
|
||||||
if (item->command == TODO_EXEC) {
|
if (item->command == TODO_EXEC) {
|
||||||
item->commit = NULL;
|
item->commit = NULL;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче