Skip to content

Commit 9eb2308

Browse files
szedergitster
authored andcommitted
test_must_be_empty: simplify file existence check
Commit 11395a3 (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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 11395a3 commit 9eb2308

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

t/test-lib-functions.sh

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -718,11 +718,8 @@ verbose () {
718718
# otherwise.
719719

720720
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"
726723
then
727724
echo "'$1' is not empty, it contains:"
728725
cat "$1"

0 commit comments

Comments
 (0)