Skip to content

fix(gitattributes): pin *.txt to LF - #2527

Closed
mlaniak wants to merge 1 commit into
garrytan:mainfrom
mlaniak:fix/gitattributes-txt-eol-lf
Closed

fix(gitattributes): pin *.txt to LF#2527
mlaniak wants to merge 1 commit into
garrytan:mainfrom
mlaniak:fix/gitattributes-txt-eol-lf

Conversation

@mlaniak

@mlaniak mlaniak commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

One line added to .gitattributes:

*.txt        text eol=lf

Why

.gitattributes already pins LF for every other text format in the repo — *.md, *.tmpl, *.yml, *.yaml, *.json, *.toml, *.sh, *.bash, setup, bin/*, **/scripts/*, *.ts/tsx/js/mjs/cjs, and the hash-pinned lib/diagram-render/dist/*. *.txt is the one text format left out.

On Windows with core.autocrlf=true, the two tracked .txt files get rewritten to CRLF at checkout, so git status is never clean in a fresh clone.

Repro

Fresh clone of main, core.autocrlf=true, comparing blob bytes to worktree bytes:

gstack/llms.txt                                    blob=12443  worktree=12617  +174
make-pdf/test/fixtures/combined-gate.expected.txt  blob=987    worktree=1007   +20
README.md                                          blob=45456  worktree=45456    0   <- pinned, unaffected

Exactly one byte per line, and README.md is the control: it is pinned by *.md text eol=lf and comes out clean. With this patch both .txt files also come out at delta 0.

User-visible symptom

git status reports gstack/llms.txt as modified forever. Because /gstack-upgrade runs git stash before git reset --hard, every upgrade saves a phantom stash — one whose diff against its own parent is empty. The user is then told to git stash pop to recover changes that never existed.

Scope

Only the two files above are affected today. I checked make-pdf/test/fixtures/combined-gate.expected.txt since it is an expected-output fixture, but copyPasteGate runs the text through normalize() and collapseWhitespace(), so I could not produce a test failure from the CRLF — this is a cleanliness fix, not a test fix.

Note for existing checkouts

The attribute only affects future checkouts. Anyone with a dirty tree today needs a one-time renormalize:

git add --renormalize .
# or, per file:
rm gstack/llms.txt && git checkout -- gstack/llms.txt

Verified on Windows (Git for Windows, core.autocrlf=true) against main @ v1.61.0.0.

.gitattributes pins LF for every other text format in the repo (*.md,
*.tmpl, *.yml, *.yaml, *.json, *.toml, *.sh, *.ts, extensionless scripts,
even the hash-pinned diagram-render dist files). *.txt is the one text
format left unpinned.

On Windows with core.autocrlf=true, that means the two tracked .txt files
are rewritten to CRLF at checkout and then read as permanently modified:

  gstack/llms.txt                                   +174 bytes
  make-pdf/test/fixtures/combined-gate.expected.txt  +20 bytes

git status is never clean, and /gstack-upgrade's 'git stash' step saves a
phantom stash on every upgrade — one that pops back to an empty diff.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@trunk-io

trunk-io Bot commented Aug 11, 2026

Copy link
Copy Markdown

Merging to main in this repository is managed by Trunk.

  • To merge this pull request, check the box to the left or comment /trunk merge below.

After your PR is submitted to the merge queue, this comment will be automatically updated with its status. If the PR fails, failure details will also be posted here

@garrytan

Copy link
Copy Markdown
Owner

Thank you — this was absorbed on main (credited in the v1.6x CHANGELOG entries; roster in PR #2604). Closing.

@garrytan garrytan closed this Aug 17, 2026
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.

2 participants