]> git.ipfire.org Git - thirdparty/git.git/commitdiff
chainlint: add explanatory comments
authorEric Sunshine <sunshine@sunshineco.com>
Tue, 8 Nov 2022 19:08:27 +0000 (19:08 +0000)
committerTaylor Blau <me@ttaylorr.com>
Tue, 8 Nov 2022 20:10:49 +0000 (15:10 -0500)
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>
Signed-off-by: Taylor Blau <me@ttaylorr.com>
t/chainlint.pl

index 976db4b8a01b804e7e697c308f769233083a576c..9908de6c758e567082f492a03db2d46a968ca9d7 100755 (executable)
@@ -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?