Skip to content

Check out text files with LF on every machine - #17

Merged
wirelessdreamer merged 1 commit into
mainfrom
fix/lf-line-endings
Nov 3, 2026
Merged

wirelessdreamer merged 1 commit into
mainfrom
fix/lf-line-endings

Conversation

@wirelessdreamer

Copy link
Copy Markdown
Owner

Problem

On a Windows clone with core.autocrlf=true (Git for Windows' default), scripts/build_indexes.py fails:

ValueError: Immutable revision already exists with different bytes: source_tokens.json

Checkout converts the file to CRLF, and install_immutable compares raw bytes against the LF it generates. With no index, /search/concordance returns 500 and /corpus/layers returns an empty list.

Fix

Add .gitattributes with * text=auto eol=lf. It covers the whole repo because raw bytes are also hashed outside content/: _resolver_hash reads files in app/services/, and the psalm import reads source XML. Every text file is already LF in the index, so no files are renormalized. Images and archives stay binary.

Testing

  • New regression test: tests/unit/test_line_endings.py failed before the fix and passes after it.
  • Unit suite: tests/unit passes (636 tests).
  • Fresh clone with core.autocrlf=true: all text files check out as LF, build_indexes.py exits 0, validate_content.py reports errors: [], /corpus/layers returns ["literal","lyric"], and /search/concordance?query=shepherd returns 200.
  • Not run: integration and golden suites.

Existing Windows checkouts

Pulling this does not rewrite files Git already considers unchanged, so an existing CRLF checkout still fails the rebuild until it is refreshed. This worked in a test clone, but it discards uncommitted changes to tracked files, so commit them first:

git read-tree --empty && git checkout HEAD -- .

A new clone also works.

🤖 Generated with Claude Code

Hash and immutable-file checks compare raw bytes, so a Windows clone with
core.autocrlf=true could not rebuild its indexes: install_immutable found
source_tokens.json converted to CRLF and refused it. The index already holds
LF everywhere, so pinning the checkout needs no renormalization.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@wirelessdreamer
wirelessdreamer merged commit 936e9c2 into main Nov 3, 2026
0 of 3 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