aboutsummaryrefslogtreecommitdiffhomepage
path: root/dev/tools
diff options
context:
space:
mode:
authorGravatar Gaëtan Gilbert <gaetan.gilbert@skyskimmer.net>2018-02-08 17:13:49 +0100
committerGravatar Gaëtan Gilbert <gaetan.gilbert@skyskimmer.net>2018-02-08 17:17:15 +0100
commitaab9a48b16ffbc6b697da39d314298b692447b72 (patch)
tree395e20725b72ccdcd0f155dd4b27a251f6e63ae6 /dev/tools
parent8cefdd3289776ed58199e5f608802546d6681eef (diff)
pre-commit: nicer messages
Diffstat (limited to 'dev/tools')
-rwxr-xr-xdev/tools/pre-commit7
1 files changed, 6 insertions, 1 deletions
diff --git a/dev/tools/pre-commit b/dev/tools/pre-commit
index 656455aee..c9cdee84a 100755
--- a/dev/tools/pre-commit
+++ b/dev/tools/pre-commit
@@ -18,6 +18,7 @@ then
1>&2 echo "Patches are saved in '$index', '$fixed_index' and '$tree'."
1>&2 echo "If an error destroys your changes you can recover using them."
1>&2 echo "(The files are cleaned up on success.)"
+ 1>&2 echo #newline
git diff-index -p --cached HEAD > "$index"
git diff-index -p HEAD > "$tree"
@@ -29,10 +30,12 @@ then
# Fix index
# For end of file newlines we must go through the worktree
+ 1>&2 echo "Fixing staged changes..."
git apply --cached --whitespace=fix "$index"
- git apply --whitespace=fix "$index"
+ git apply --whitespace=fix "$index" 2>/dev/null # no need to repeat yourself
git diff --cached --name-only -z | xargs -0 dev/tools/check-eof-newline.sh --fix
git add -u
+ 1>&2 echo #newline
# reset work tree
git diff-index -p --cached HEAD > "$fixed_index"
@@ -44,8 +47,10 @@ then
fi
# Fix worktree
+ 1>&2 echo "Fixing unstaged changes..."
git apply --whitespace=fix "$tree"
git diff --name-only -z | xargs -0 dev/tools/check-eof-newline.sh --fix
+ 1>&2 echo #newline
if ! [ -s "$fixed_index" ]
then