Skip to content

normalize line endings with .gitattributes - #60

Merged
achubaty merged 2 commits into
developmentfrom
chore-gitattributes-line-endings
Aug 10, 2026
Merged

normalize line endings with .gitattributes#60
achubaty merged 2 commits into
developmentfrom
chore-gitattributes-line-endings

Conversation

@achubaty

Copy link
Copy Markdown
Collaborator

The repository had no .gitattributes, and contributors work across Windows, Linux and macOS, so files were committed with whatever line endings the author's editor produced. Three text files had drifted to CRLF while everything else was LF:

  • NAMESPACE
  • tests/test-all.R
  • tests/testthat/test-NetLogoR-classes.R

* text=auto stores LF in the repository and checks out whatever is native, so this stops mattering. Binary types are spelled out so they are never touched, common text types so they are never misdetected.

Reviewing this

The renormalization looks enormous because two files were rewritten end to end, but the only content change is .gitattributes itself:

$ git diff --ignore-cr-at-eol --stat 420a878^ 420a878
 .gitattributes | 35 +++++++++++++++++++++++++++++++++++
 1 file changed, 35 insertions(+)

Reviewing with whitespace ignored, or just reading that one file, is enough.

The renormalization commit is listed in a new .git-blame-ignore-revs, so it does not get in the way of git blame. GitHub honours that file automatically; locally it needs git config blame.ignoreRevsFile .git-blame-ignore-revs.

Why now

Mixed endings caused a real failure while rebasing #59. Editing the CRLF test file with a script silently rewrote it as LF, turning an 81-line addition into a 250/169 whole-file diff, and dropped a closing }) — because Python's splitlines() splits on more characters than \n, so line indices computed that way disagree with grep -n. The test suite caught it, but it should not have been possible in the first place.

This was deliberately held until #57, #58 and #59 had all landed, since renormalizing conflicts with anything in flight.

Verification

Checked against a fresh clone of the branch rather than the existing working tree, which is the only way to see what a new checkout actually gets:

  • all three files check out LF
  • R CMD check --as-cran: 0 errors, 0 warnings, 0 notes

R CMD build already leaves .gitattributes out of the tarball, but it does not exclude .git-blame-ignore-revs — that produced a checking for hidden files and directories NOTE, so it is added to .Rbuildignore.

🤖 Generated with Claude Code

achubaty and others added 2 commits August 10, 2026 14:35
Contributors work across Windows, Linux and macOS and the repository had
no .gitattributes, so files were committed with whatever endings the
author's editor produced. Three text files had ended up with CRLF while
everything else was LF: NAMESPACE, tests/test-all.R and
tests/testthat/test-NetLogoR-classes.R.

`* text=auto` stores LF in the repository and checks out whatever is
native, so this stops mattering. Binary types are spelled out so they are
never touched, and the common text types so they are never misdetected.

The three files are renormalized here. Apart from .gitattributes itself
the change is only the removal of carriage returns:

  git diff --cached --ignore-cr-at-eol --stat
  # .gitattributes | 35 +++++++++

R CMD build already leaves .gitattributes out of the tarball, so it needs
no .Rbuildignore entry.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
That commit rewrote three files end to end without changing anything in
them, so it only gets in the way when tracking down when a line actually
changed. GitHub reads this file automatically; locally it needs

  git config blame.ignoreRevsFile .git-blame-ignore-revs

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@achubaty
achubaty merged commit 8d8ff5e into development Aug 10, 2026
14 checks passed
@achubaty
achubaty deleted the chore-gitattributes-line-endings branch August 10, 2026 21:52
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