Skip to content

Commit 11f470a

Browse files
committed
test: caution on our version of 'yes'
During a review of a patch, we noticed that we use our own imitation of 'yes' with the limit of 99 lines. It is very tempting to lift this arbitrary limit, but the limit is there for a reason. Add an in-code comment to prevent future developers from wasting their time. Signed-off-by: Junio C Hamano <[email protected]>
1 parent 11ad41d commit 11f470a

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

t/README

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -927,6 +927,15 @@ library for your script to use.
927927
test_oid_init or test_oid_cache. Providing an unknown key is an
928928
error.
929929

930+
- yes [<string>]
931+
932+
This is often seen in modern UNIX but some platforms lack it, so
933+
the test harness overrides the platform implementation with a
934+
more limited one. Use this only when feeding a handful lines of
935+
output to the downstream---unlike the real version, it generates
936+
only up to 99 lines.
937+
938+
930939
Prerequisites
931940
-------------
932941

t/test-lib.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1313,7 +1313,11 @@ then
13131313
fi
13141314
fi
13151315

1316-
# Provide an implementation of the 'yes' utility
1316+
# Provide an implementation of the 'yes' utility; the upper bound
1317+
# limit is there to help Windows that cannot stop this loop from
1318+
# wasting cycles when the downstream stops reading, so do not be
1319+
# tempted to turn it into an infinite loop. cf. 6129c930 ("test-lib:
1320+
# limit the output of the yes utility", 2016-02-02)
13171321
yes () {
13181322
if test $# = 0
13191323
then

0 commit comments

Comments
 (0)