diff --git a/contrib/check-code.py b/contrib/check-code.py --- a/contrib/check-code.py +++ b/contrib/check-code.py @@ -94,6 +94,8 @@ utestpats = [ "explicit exit code checks unnecessary"), (uprefix + r'set -e', "don't use set -e"), (uprefixc + r'( *)\t', "don't use tabs to indent"), + (uprefixc + r'.*do\s*true;\s*done', + "don't use true as loop body, use sleep 0"), ], # warnings [] diff --git a/tests/test-hup.t b/tests/test-hup.t --- a/tests/test-hup.t +++ b/tests/test-hup.t @@ -11,7 +11,7 @@ Do test while holding fifo open $ ( > echo lock > echo addchangegroup - > while [ ! -s .hg/store/journal ]; do true; done + > while [ ! -s .hg/store/journal ]; do sleep 0; done > kill -HUP $P > ) > p diff --git a/tests/test-serve.t b/tests/test-serve.t --- a/tests/test-serve.t +++ b/tests/test-serve.t @@ -14,7 +14,7 @@ > else > kill `cat hg.pid` > fi - > while kill -0 `cat hg.pid` 2>/dev/null; do true; done + > while kill -0 `cat hg.pid` 2>/dev/null; do sleep 0; done > } $ hg init test