Junio C Hamano [off-list ref] writes:
quoted
test_must_be_empty () {
- if ! test -f "$1"
- then
- echo "'$1' is missing"
- return 1
- elif test -s "$1"
+ test_path_is_file "$1" &&
+ if test -s "$1"
then
echo "'$1' is not empty, it contains:"
cat "$1"
"Just call it" is fine as an idea but
A &&
if B
then
...
fi
is somewhat questionable. Shouldn't we make it
if A && B
then
...
fi
instead?
Nah, you want to treat A's success as a condition *not* to enter the
"then" clause in this case, so my rewrite is bogus. SOrry for the
noise.