diff --git a/scripts/pre-commit.git-lint.sh b/scripts/pre-commit.git-lint.sh index d432bdb..2558410 100755 --- a/scripts/pre-commit.git-lint.sh +++ b/scripts/pre-commit.git-lint.sh @@ -14,8 +14,13 @@ # limitations under the License. # First part return the files being commited, excluding deleted files. -git diff-index -z --cached HEAD --name-only --diff-filter=ACMRTUXB | -xargs --null --no-run-if-empty git lint; +DIFF_FILES=$(git diff-index -z --cached HEAD --name-only --diff-filter=ACMRTUXB) +if [ -z "$DIFF_FILES" ] +then + exit 0; +else + git diff-index -z --cached HEAD --name-only --diff-filter=ACMRTUXB | xargs -0 git lint; +fi if [ "$?" != "0" ]; then echo "There are some problems with the modified files."; diff --git a/scripts/pre-commit.hg-lint.sh b/scripts/pre-commit.hg-lint.sh index 4a7cacf..fb3b8a7 100644 --- a/scripts/pre-commit.hg-lint.sh +++ b/scripts/pre-commit.hg-lint.sh @@ -18,8 +18,13 @@ if [ "$NO_VERIFY" != "" ]; then exit 0 fi -hg status --change $HG_NODE | cut -b 3- | tr '\n' '\0' | -xargs --null --no-run-if-empty git-lint; +DIFF_FILES=$(hg status --change $HG_NODE | cut -b 3- | tr '\n' '\0') +if [ -z "$DIFF_FILES" ] +then + exit 0; +else + hg status --change $HG_NODE | cut -b 3- | tr '\n' '\0' | xargs -0 git lint; +fi if [ "$?" != "0" ]; then echo "There are some problems with the modified files.";