summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhillip Wood <phillip.wood@dunelm.org.uk>2024-03-17 18:08:50 +0000
committerGitHub <noreply@github.com>2024-03-17 14:08:50 -0400
commitffaaba9890a5ef553f46949297080ecd9b60afdb (patch)
tree710695e3e6f76e66c782091849c17973ac55fd79
parent4b80dfb04c4a6e2dc841408345a2f72d441cf161 (diff)
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.
-rw-r--r--.gitattributes1
1 files changed, 1 insertions, 0 deletions
diff --git a/.gitattributes b/.gitattributes
index 7096c795..2ef665c9 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