From ffaaba9890a5ef553f46949297080ecd9b60afdb Mon Sep 17 00:00:00 2001 From: Phillip Wood Date: Sun, 17 Mar 2024 18:08:50 +0000 Subject: [PATCH] add .gitattributes rules for rust files (#1245) While delta currently removes git's whitespace error markup from diffs adding the whitespace rules will mean pre-commit hooks that run `git diff --check` will reject changes with whitespace errors. In order to get git to print the correct position of the error when there is an unwanted tab in the indent following a space it is necessary to turn off `space-before-tab` otherwise the space will be considered to be an error instead of the tab. The whitespace rule could perhaps be applied more widely but the Makefile and example gitcofig have leading tabs so it is restricted them to just rust files for now. --- .gitattributes | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitattributes b/.gitattributes index 7096c795b..2ef665c9a 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,2 +1,3 @@ *.Makefile linguist-language=Makefile etc/performance/* linguist-vendored +*.rs whitespace=tab-in-indent,trailing-space,-space-before-tab eol=lf