Skip to content
Snippets Groups Projects
Commit 420ac3b5 authored by Mark Olesen's avatar Mark Olesen
Browse files

ENH: skip checks in pre-commit hook when no files have changed

- this usage can correspond to a 'git commit --amend'
parent e564a981
Branches
Tags
No related merge requests found
...@@ -55,6 +55,7 @@ die() ...@@ -55,6 +55,7 @@ die()
echo '-----------------------' 1>&2 echo '-----------------------' 1>&2
echo '' 1>&2 echo '' 1>&2
echo "$@" 1>&2 echo "$@" 1>&2
echo '' 1>&2
exit 1 exit 1
} }
...@@ -85,7 +86,12 @@ else ...@@ -85,7 +86,12 @@ else
fileList=$(git diff-index --cached --name-only $against --) fileList=$(git diff-index --cached --name-only $against --)
fi fi
# echo "files: $fileList" 1>&2 #
# no files changed: can skip all the checks
# this usage can correspond to a 'git commit --amend'
#
[ -n "$fileList" ] || exit 0
unset badFiles unset badFiles
# join list of files with this amount of space # join list of files with this amount of space
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment