summaryrefslogtreecommitdiff
path: root/hooks/pre-commit.mix_format
diff options
context:
space:
mode:
Diffstat (limited to 'hooks/pre-commit.mix_format')
-rwxr-xr-x[-rw-r--r--]hooks/pre-commit.mix_format3
1 files changed, 3 insertions, 0 deletions
diff --git a/hooks/pre-commit.mix_format b/hooks/pre-commit.mix_format
index c201707..8db706f 100644..100755
--- 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: