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

[PATCH 1/4] chainlint: add explanatory comments

From
Eric Sunshine via GitGitGadget <gitgitgadget@gmail.com>
Date
Nov 8, 2022, 19:08 UTC
Message-ID
<a445304594c6139770439c49cf18f10c6757cbab.1667934510.git.gitgitgadget@gmail.com>
In-Reply-To
<pull.1375.git.git.1667934510.gitgitgadget@gmail.com>
From: Eric Sunshine <sunshine@sunshineco.com>

The logic in TestParser::accumulate() for detecting broken &&-chains is mostly well-commented, but a couple branches which were deemed obvious and straightforward lack comments. In retrospect, though, these cases may give future readers pause, so comment them, as well.

Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
---
 t/chainlint.pl | 4 ++++
 1 file changed, 4 insertions(+)
diff --git a/t/chainlint.pl b/t/chainlint.pl
index 976db4b8a01..9908de6c758 100755
--- a/t/chainlint.pl
+++ b/t/chainlint.pl
@@ -505,7 +505,11 @@ my @safe_endings = (
 
 sub accumulate {
 	my ($self, $tokens, $cmd) = @_;
+
+	# no previous command to check for missing "&&"
 	goto DONE unless @$tokens;
+
+	# new command is empty line; can't yet check if previous is missing "&&"
 	goto DONE if @$cmd == 1 && $$cmd[0] eq "\n";
 
 	# did previous command end with "&&", "|", "|| return" or similar?
-- 
gitgitgadget
Previous: Eric Sunshine via GitGitGadgetNext: Eric Sunshine via GitGitGadget
Message 2 of 11 in “chainlint: improve annotated output”
  1. 0/4 chainlint: improve annotated outputEric Sunshine via GitGitGadget, Nov 8, 2022
  2. 1/4 chainlint: add explanatory commentsEric Sunshine via GitGitGadget, Nov 8, 2022
  3. 2/4 chainlint: tighten accuracy when consuming input streamEric Sunshine via GitGitGadget, Nov 8, 2022
  4. 3/4 chainlint: latch start/end position of each tokenEric Sunshine via GitGitGadget, Nov 8, 2022
  5. 4/4 chainlint: annotate original test definition rather than token streamEric Sunshine via GitGitGadget, Nov 8, 2022
  6. Taylor BlauNov 8, 2022
  7. Jeff KingNov 9, 2022
  8. Taylor BlauNov 10, 2022
  9. Ævar Arnfjörð BjarmasonNov 8, 2022
  10. Eric SunshineNov 8, 2022
  11. Eric SunshineNov 8, 2022

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.