Skip to content

gitattributes: normalise all text files to LF - #553

Merged
Sapd merged 1 commit into
masterfrom
fix-eol-normalization
Jul 30, 2026
Merged

gitattributes: normalise all text files to LF#553
Sapd merged 1 commit into
masterfrom
fix-eol-normalization

Conversation

@Sapd

@Sapd Sapd commented Jul 30, 2026

Copy link
Copy Markdown
Owner

The MinGW CI build stamped every Windows binary as "-modified" even on a pristine checkout. Cause, reproduced on a Windows 11 + MSYS2 box:

Git for Windows core.autocrlf = true (its own system gitconfig)
MSYS2 git core.autocrlf = unset -> false

actions/checkout runs under Git for Windows and writes CRLF; the build then reads the tree with MSYS2 git, which expects LF. Files covered by an extension rule were fine, but 14 were not matched by any pattern and showed up permanently modified:

i/lf w/crlf attr/ .clang-format
i/lf w/crlf attr/ debian/rules

Note the empty attr/ column. The gaps were dotfiles, extensionless files, debian/*, *.rc, *.spec, *.sh, and lib/version.h.in (which *.h does not match). Listing extensions cannot close this class of gap -- the next unlisted file type reopens it -- so replace the list with a catch-all.

The catch-all must come first, because git applies the last matching pattern per attribute and the binary declarations need to override it. Verified: assets/headsetcontrol.{ico,png} still resolve to text=unset binary=set, and git add --renormalize . rewrites no blob, since every file was already LF in the index.

Besides CI, this also fixes the same false-dirty state for anyone developing on Windows.

The MinGW CI build stamped every Windows binary as "<version>-modified" even
on a pristine checkout. Cause, reproduced on a Windows 11 + MSYS2 box:

  Git for Windows  core.autocrlf = true    (its own system gitconfig)
  MSYS2 git        core.autocrlf = unset -> false

actions/checkout runs under Git for Windows and writes CRLF; the build then
reads the tree with MSYS2 git, which expects LF. Files covered by an
extension rule were fine, but 14 were not matched by any pattern and showed
up permanently modified:

  i/lf    w/crlf  attr/     .clang-format
  i/lf    w/crlf  attr/     debian/rules

Note the empty attr/ column. The gaps were dotfiles, extensionless files,
debian/*, *.rc, *.spec, *.sh, and lib/version.h.in (which *.h does not
match). Listing extensions cannot close this class of gap -- the next
unlisted file type reopens it -- so replace the list with a catch-all.

The catch-all must come first, because git applies the last matching pattern
per attribute and the binary declarations need to override it. Verified:
assets/headsetcontrol.{ico,png} still resolve to text=unset binary=set, and
`git add --renormalize .` rewrites no blob, since every file was already LF
in the index.

Besides CI, this also fixes the same false-dirty state for anyone developing
on Windows.
@Sapd
Sapd merged commit 3735bf9 into master Jul 30, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant