From eaa393ef05d11af57a7a5e923aad23834917e063 Mon Sep 17 00:00:00 2001 From: Jim Huang Date: Mon, 7 Sep 2020 19:14:48 +0800 Subject: [PATCH] Do not list files when no source file is changed --- scripts/pre-commit.hook | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/scripts/pre-commit.hook b/scripts/pre-commit.hook index 3b7e43723..795c04ae8 100755 --- a/scripts/pre-commit.hook +++ b/scripts/pre-commit.hook @@ -67,8 +67,10 @@ for FILE in $FILES; do fi done -echo "Following files need to be cleaned up:" -echo "${FILES[*]}" +if [ ! -z "${FILES[*]}" ]; then + echo "Following files need to be cleaned up:" + echo "${FILES[*]}" +fi # Prevent unsafe functions root=$(git rev-parse --show-toplevel)