From dea86a64aa2a3d9d45c335eae307d8a5f327d4ec Mon Sep 17 00:00:00 2001 From: Guillermo Ramos Date: Thu, 23 Apr 2020 20:34:16 +0200 Subject: Improve pre-commit --- hooks/pre-commit.mix_format | 3 +++ 1 file changed, 3 insertions(+) mode change 100644 => 100755 hooks/pre-commit.mix_format diff --git a/hooks/pre-commit.mix_format b/hooks/pre-commit.mix_format old mode 100644 new mode 100755 index c201707..8db706f --- a/hooks/pre-commit.mix_format +++ b/hooks/pre-commit.mix_format @@ -4,6 +4,9 @@ # breaks git-stash export GIT_LITERAL_PATHSPECS=0 +# Skip hook if there are no changes to be committed +[ -z "$(git status --porcelain=v1)" ] && exit 0 + ################################################################################ # Here is a fine piece of Git wizardry. It uses git stash to make sure that the # staged changes are correctly formatted: -- cgit v1.2.3