-
Notifications
You must be signed in to change notification settings - Fork 143
/
.gitattributes
31 lines (31 loc) · 1.65 KB
/
.gitattributes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# Our code formatter, Spotless, checks that file line endings match whatever
# Git thinks they should be. Unfortunately, Git's default thinking is that
# lines should follow the platform's native line ending: see
# https://git-scm.com/docs/git-config#Documentation/git-config.txt-coreeol.
# Git has this thought rattling around in the back of its mind even when
# automatic line ending convertion (`core.autocrlf`) is turned off (`false`).
# When Spotless rolls up and asks Git what it thinks on a Windows system, it'll
# say “CRLF” (assuming the user hasn't overridden `core.eol`), even when all of
# the checked-out files are LF-terminated. So Spotless will throw an error for
# every. Single. Line of source.
#
# The solution is to tell Git that we want all files (`*`) to be LF-terminated
# (`eol=lf`), but we don't ever want it to do any conversions automatically
# (`-text`).
#
# Some sources, including Spotless themselves (https://github.com/diffplug/
# spotless/tree/main/plugin-gradle#line-endings-and-encodings-invisible-stuff),
# suggest using:
#
# * text eol=lf
#
# This forces Git to treat all files (`*`) as text (`text`) with LF-terminated
# lines (`eol=lf`). This configuration will break any binary files checked into
# the repository! Git will perform end-of-line mangling – sorry,
# “normalization” – on checkout of all files it thinks contain text. If it
# thinks your binary files are text and should have LF-terminated lines, then
# it'll happily replace all CRLF byte sequences (0x0D0A) with just LF (0x0A).
#
# So, to recap: keep line ending conversions disabled, but maintain a correct
# opinion about what the line endings should be.
* -text eol=lf