test_must_be_empty: simplify file existence check
Commit 11395a3b4b (test_must_be_empty: make sure the file exists, not just empty, 2018-02-27) basically duplicated the 'test_path_is_file' helper function in 'test_must_be_empty'. Just call 'test_path_is_file' to avoid this code duplication. Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
SZEDER Gábor committed
Mar 26, 2018 at 15:11 UTC
9eb2308019b92625c659f759a6a27b5edeb1d815
1 file changed
+2
-5
t/test-lib-functions.sh
+2
-5
@@ -718,11 +718,8 @@ verbose () {
718
# otherwise.
719
720
test_must_be_empty () {
721
- if ! test -f "$1"
722
- then
723
- echo "'$1' is missing"
724
- return 1
725
- elif test -s "$1"
721
+ test_path_is_file "$1" &&
722
+ if test -s "$1"
723
then
724
echo "'$1' is not empty, it contains:"
725
cat "$1"