summaryrefslogtreecommitdiff
path: root/sequencer.c
diff options
context:
space:
mode:
authorJohannes Schindelin <johannes.schindelin@gmx.de>2017-12-22 23:55:57 (GMT)
committerJunio C Hamano <gitster@pobox.com>2017-12-27 20:33:38 (GMT)
commit66afa24fb36f15c49aed76be2f04bd23dd0e55c8 (patch)
treeb2b68ade2968be2fbc48acf101790856c28bba21 /sequencer.c
parent5f8f927710a039ce3068ac55ca87354477a199b9 (diff)
downloadgit-66afa24fb36f15c49aed76be2f04bd23dd0e55c8.zip
git-66afa24fb36f15c49aed76be2f04bd23dd0e55c8.tar.gz
git-66afa24fb36f15c49aed76be2f04bd23dd0e55c8.tar.bz2
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>
Diffstat (limited to 'sequencer.c')
-rw-r--r--sequencer.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/sequencer.c b/sequencer.c
index e9fef58..b005e41 100644
--- a/sequencer.c
+++ b/sequencer.c
@@ -1261,18 +1261,23 @@ static int parse_insn_line(struct todo_item *item, const char *bol, char *eol)
if (i >= TODO_COMMENT)
return -1;
+ /* Eat up extra spaces/ tabs before object name */
+ padding = strspn(bol, " \t");
+ bol += padding;
+
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->arg = bol;
item->arg_len = eol - bol;
return 0;
}
- /* Eat up extra spaces/ tabs before object name */
- padding = strspn(bol, " \t");
if (!padding)
- return -1;
- bol += padding;
+ return error(_("missing arguments for %s"),
+ command_to_string(item->command));
if (item->command == TODO_EXEC) {
item->commit = NULL;