Skip to content

Commit

Permalink
add .gitattributes rules for rust files
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
phillipwood committed Mar 17, 2024
1 parent afa7a1a commit ff96130
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
*.Makefile linguist-language=Makefile
etc/performance/* linguist-vendored
*.rs whitespace=tab-in-indent,trailing-space,-space-before-tab eol=lf

0 comments on commit ff96130

Please sign in to comment.