From: Junio C Hamano Date: Wed, 28 Mar 2018 05:20:05 GMT Subject: Re: [PATCH v2] test_must_be_empty: simplify file existence check Message-ID: In-Reply-To: Junio C Hamano writes: >> 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.