aboutsummaryrefslogtreecommitdiffhomepage
path: root/dev/tools/pre-commit
diff options
context:
space:
mode:
authorGravatar Pierre Letouzey <pierre.letouzey@inria.fr>2018-04-17 09:18:35 +0200
committerGravatar Pierre Letouzey <pierre.letouzey@inria.fr>2018-04-17 10:17:49 +0200
commit7fcae05d6f1a03750d636a61a80d89e2cc6ce0cc (patch)
tree4eaeb3810a54abde2df70314c0cac3ef322777cb /dev/tools/pre-commit
parenta34bd320aed7027c46021643cd2495baa0a17089 (diff)
pre-commit : do not fail miserably if git config has `apply.whitespace = fix`
Having `--whitespace=` on all `git apply` in this script should make it insensitive to user setup in `~/.gitconfig`, at least `[apply] whitespace = fix`. Note that even this way, this script remains hugely fragile and non mature, and would better *not* be set by default for everybody.
Diffstat (limited to 'dev/tools/pre-commit')
-rwxr-xr-xdev/tools/pre-commit6
1 files changed, 3 insertions, 3 deletions
diff --git a/dev/tools/pre-commit b/dev/tools/pre-commit
index a514b8866..b56925c37 100755
--- a/dev/tools/pre-commit
+++ b/dev/tools/pre-commit
@@ -27,8 +27,8 @@ then
# reset work tree and index
# NB: untracked files which were not added are untouched
- git apply --cached -R "$index"
- git apply -R "$tree"
+ git apply --whitespace=nowarn --cached -R "$index"
+ git apply --whitespace=nowarn -R "$tree"
# Fix index
# For end of file newlines we must go through the worktree
@@ -45,7 +45,7 @@ then
# making git fail. Don't fail now: we fix the worktree first.
if [ -s "$fixed_index" ]
then
- git apply -R "$fixed_index"
+ git apply --whitespace=nowarn -R "$fixed_index"
fi
# Fix worktree