summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuillermo Ramos2020-04-23 20:34:16 +0200
committerGuillermo Ramos2020-04-23 20:34:16 +0200
commitdea86a64aa2a3d9d45c335eae307d8a5f327d4ec (patch)
tree2c299da615a74b747075b4d8fe51b4551be9acf8
parent9737166ce9bdb188d51912f7e4e34f6e941b35d4 (diff)
downloadgit-utils-dea86a64aa2a3d9d45c335eae307d8a5f327d4ec.tar.gz
Improve pre-commitHEADmaster
-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: