git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 4/5] sequencer: report when noop has an argument

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Dec 22, 2017, 23:55 UTC
Message-ID
<5fe76040e25993662002c421a5fbcb3ea2d00c96.1513986836.git.johannes.schindelin@gmx.de>
In-Reply-To
<cover.1513986836.git.johannes.schindelin@gmx.de>

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>
---
 sequencer.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/sequencer.c b/sequencer.c
index 38266c3c228..5632415ea2d 100644
--- a/sequencer.c
+++ b/sequencer.c
@@ -1259,18 +1259,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;
-- 
2.15.1.windows.2
Previous: Johannes SchindelinNext: Johannes Schindelin
Message 5 of 8 in “A couple of sequencer cleanups”
  1. 0/5 A couple of sequencer cleanupsJohannes Schindelin, Dec 22, 2017
  2. 1/5 rebase: do not continue when the todo list generation failedJohannes Schindelin, Dec 22, 2017
  3. 2/5 sequencer: strip bogus LF at end of error messagesJohannes Schindelin, Dec 22, 2017
  4. 3/5 sequencer: remove superfluous conditionalJohannes Schindelin, Dec 22, 2017
  5. 4/5 sequencer: report when noop has an argumentJohannes Schindelin, Dec 22, 2017
  6. 5/5 sequencer: do not invent whitespace when transforming OIDsJohannes Schindelin, Dec 22, 2017
  7. Liam BeguinDec 27, 2017
  8. Junio C HamanoDec 27, 2017

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.