Skip to content

build: normalize line endings to LF via .gitattributes (V2-679) - #12

Merged
Nic-dorman merged 1 commit into
mainfrom
build/gitattributes-eol
Jul 21, 2026
Merged

build: normalize line endings to LF via .gitattributes (V2-679)#12
Nic-dorman merged 1 commit into
mainfrom
build/gitattributes-eol

Conversation

@Nic-dorman

Copy link
Copy Markdown
Member

Problem

The repo had no .gitattributes and core.autocrlf=true locally, so nothing normalized line endings — what a build produced depended on when each file was last checked out. build.mjs copies HTML/CSS verbatim (copyFileSync) into the shipped package, so a working-tree build could diverge byte-for-byte from a git archive build. That breaks AMO's source review, which requires a reviewer to reproduce the uploaded package byte-for-byte from the source zip (BUILD.md).

Fix

Add .gitattributes:

  • * text=auto eol=lf — deterministic LF on checkout, on every platform.
  • binary rules for image/font/archive types (.png is the only one tracked today; the rest are future-proofing).

The git add --renormalize . step was a no-op — the committed blobs were already LF, so there's no separate normalization commit. The divergence was purely a checkout artifact of core.autocrlf=true, which eol=lf now overrides.

Verification

Built from the working tree and from a clean git archive export (npm ci + npm run build:all), then compared SHA-256 of every output file:

  • dist/ (Chrome, 14 files): byte-identical
  • dist-firefox/ (Firefox, 14 files): byte-identical

Also confirmed git archive emits pure LF for every tracked text file under autocrlf=true, stable across repeated runs.

Functionally inert for the extension — browsers don't care about CRLF in HTML/CSS; this is purely about build reproducibility.

Closes V2-679.

🤖 Generated with Claude Code

core.autocrlf produced a mixed working tree, so a working-tree build could diverge byte-for-byte from a git archive build and break AMO's source-code reproduction. '* text=auto eol=lf' makes checkout deterministic across platforms.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@Nic-dorman
Nic-dorman merged commit 5548e46 into main Jul 21, 2026
1 check 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