From 7fcae05d6f1a03750d636a61a80d89e2cc6ce0cc Mon Sep 17 00:00:00 2001 From: Pierre Letouzey Date: Tue, 17 Apr 2018 09:18:35 +0200 Subject: 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. --- dev/tools/pre-commit | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'dev/tools/pre-commit') 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 -- cgit v1.2.3