Skip to content

Commit aabc325

Browse files
sunshinecogitster
authored andcommitted
chainlint.pl: don't require & background command to end with &&
The exit status of the `&` asynchronous operator which starts a command in the background is unconditionally zero, and the few places in the test scripts which launch commands asynchronously are not interested in the exit status of the `&` operator (though they often capture the background command's PID). As such, there is little value in complaining about broken &&-chain for a command launched in the background, and doing so would only make busy-work for test authors. Therefore, take this special case into account when checking for &&-chain breakage. Signed-off-by: Eric Sunshine <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent d00113e commit aabc325

File tree

3 files changed

+20
-1
lines changed

3 files changed

+20
-1
lines changed

t/chainlint.pl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -483,7 +483,7 @@ sub match_ending {
483483
}
484484

485485
my @safe_endings = (
486-
[qr/^(?:&&|\|\||\|)$/],
486+
[qr/^(?:&&|\|\||\||&)$/],
487487
[qr/^(?:exit|return)$/, qr/^(?:\d+|\$\?)$/],
488488
[qr/^(?:exit|return)$/, qr/^(?:\d+|\$\?)$/, qr/^;$/],
489489
[qr/^(?:exit|return|continue)$/],
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
JGIT_DAEMON_PID= &&
2+
git init --bare empty.git &&
3+
> empty.git/git-daemon-export-ok &&
4+
mkfifo jgit_daemon_output &&
5+
{
6+
jgit daemon --port="$JGIT_DAEMON_PORT" . > jgit_daemon_output &
7+
JGIT_DAEMON_PID=$!
8+
} &&
9+
test_expect_code 2 git ls-remote --exit-code git://localhost:$JGIT_DAEMON_PORT/empty.git
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
JGIT_DAEMON_PID= &&
2+
git init --bare empty.git &&
3+
>empty.git/git-daemon-export-ok &&
4+
mkfifo jgit_daemon_output &&
5+
{
6+
# LINT: exit status of "&" is always 0 so &&-chaining immaterial
7+
jgit daemon --port="$JGIT_DAEMON_PORT" . >jgit_daemon_output &
8+
JGIT_DAEMON_PID=$!
9+
} &&
10+
test_expect_code 2 git ls-remote --exit-code git://localhost:$JGIT_DAEMON_PORT/empty.git

0 commit comments

Comments
 (0)