From 10979aa45875ab5514d25661bd25f77ceea83cb7 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Fri, 13 Mar 2026 10:26:48 -0700 Subject: [PATCH] =?UTF-8?q?Ignore=20Emacs=20developer=E2=80=99s=20global?= =?UTF-8?q?=20core.whitespace?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * build-aux/git-hooks/pre-commit: Use EMACS_GIT_CORE_WHITESPACE, not the global core.whitespace, for whitespace checks when committing. This defaults to empty, which means to use the Git default, and this should fix Bug#80428 “C indentation in .gitattributes, macros in .dir-locals.el”. The environment variable is a better way to temporarily override the default. --- build-aux/git-hooks/pre-commit | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/build-aux/git-hooks/pre-commit b/build-aux/git-hooks/pre-commit index 987d3d6b616..3d98b096c22 100755 --- a/build-aux/git-hooks/pre-commit +++ b/build-aux/git-hooks/pre-commit @@ -74,10 +74,12 @@ done # The '--check' option of git diff-index makes Git complain if changes # introduce whitespace errors. This can be a pain when editing test -# files that deliberately contain lines with trailing whitespace. -# To work around the problem you can run a command like 'git config -# core.whitespace -trailing-space'. It may be better to revamp the -# tests so that trailing spaces are generated on the fly rather than +# files that deliberately flout the normal whitespace rules. +# To work around the problem, set EMACS_GIT_CORE_WHITESPACE temporarily +# in your environment. For example, set it to '-blank-at-eol' to commit +# a test with blanks at line end. It may be better to revamp the +# tests so that offending lines are generated on the fly rather than # being committed as source. -exec git diff-index --check --cached $head -- +exec git -c core.whitespace="$EMACS_GIT_CORE_WHITESPACE" \ + diff-index --check --cached $head --