Skip to content

Blog's .gitattributes deliberately diverges from the fleet's text=auto pattern - accept it, or fix it? #931

Closed

Description

@ptr727

Found while resyncing Blog (ptr727/Blog #97, merged) against the hub's .gitattributes (spec/files.json declares it intent fidelity, whole: true, intentRef: GOVERNANCE.md#line-endings).

What the hub documents

comment-and-doc-style/references/line-endings.md: .gitattributes mirrors the repository-wide defaults: * text=auto eol=lf normalizes every detected text file to LF while leaving binary files byte-preserved. *.bat and *.cmd override that default to CRLF. Do not add per-language or per-file LF pins where the global LF default already applies.

What Blog actually carries, and why

* -text                          # git stays passive; .editorconfig binds only the editor
*.sh text eol=lf                 # named pins for every execution/parse-sensitive file:
ops/vps-backup-pull text eol=lf  #   shell scripts, an extensionless shebang script,
capture/*.py text eol=lf         #   shebang-executed Python, the Caddy config and its
checks/check-*.py text eol=lf    #   bootstrap variant, and the Caddy map tables
deploy/Caddyfile text eol=lf
deploy/bootstrap.Caddyfile text eol=lf
deploy/maps/*.map text eol=lf
static/media/** binary           # explicit binary marks for the two large media trees
static/external/** binary        #   plus the favicon extension, on top of -text
*.ico binary

Paired with a dedicated gate, checks/check-eol-pins.py, run every PR: it fails if a tracked shebang file (detected by reading line one, not by extension or the executable bit) carries no LF pin, and separately fails if a pinned pattern matches no tracked file (a dead pin that reads as coverage while binding nothing - this already happened once: deploy/authorized_keys and deploy/blog-deploy-shell were pinned and never existed in the repo, and that's what let the real unpinned file, ops/vps-backup-pull, go unnoticed). A third check cross-validates the script's own pattern matching against git check-attr, since the first two checks are only as trustworthy as that matching.

The two mechanisms differ substantively, not just cosmetically: text=auto lets git auto-detect text-vs-binary per file, where the reasoning above explicitly avoids that (relying on file content/shebang detection for the pin, but declaring git itself passive so a mis-detection can't silently reflow anything). -text + explicit pins + a two-directional audit is arguably the more conservative design for a repo carrying 566 MB of binary media where a bad auto-detection means the wrong outcome (a JPEG treated as text) in the exact tree size where reviewing every commit for it isn't realistic. check-eol-pins.py also does something the fleet pattern has no equivalent for anywhere I found: verifies that the pin list itself hasn't rotted (a pattern matching nothing, silently).

Ask

Not proposing a specific answer, since I don't think this is mine to decide unilaterally. Three ways this could go, roughly in order of how much it costs each side:

  1. Document -text + explicit named pins + a rotted-pin gate as an accepted alternative in line-endings.md, for a repo whose binary content is large enough that per-file review isn't realistic and where an audited pin list is cheaper to trust than text=auto's heuristic. Blog would then be conforming rather than deviating.
  2. Record it as Blog's own accepted deviation (the same shape as the lineEndings: lf registry driftNote), leaving the fleet default as text=auto for everyone else.
  3. Ask Blog to adopt text=auto eol=lf anyway, dropping the pin list and check-eol-pins.py, if the hub judges the auto-detection risk against the tree's binary content acceptable or better handled another way.

I left Blog's .gitattributes and check-eol-pins.py untouched pending this, rather than guessing at PR #97.

Activity

  1. ptr727 commented on Aug 23, 2026

    @ptr727
    OwnerAuthor

    Correction to my own analysis above, found after re-reading Blog's TODO.md more carefully (should have found this before filing): #633 (closed) and its follow-through PR #634 are directly relevant and change the answer.

    #634 ported exactly this shape into scripts/repo_gate.py as eol-coverage (unpinned + dead), using git check-attr to compare .gitattributes against the actual tree rather than against .editorconfig. That check works by asking what a file's eol attribute actually resolves to and comparing it against what should be pinned - a contrast that only exists because Blog's .gitattributes uses * -text as its baseline, so only the explicitly-pinned files resolve to eol=lf and everything else is unspecified.

    Under * text=auto eol=lf (option 3 in my post above), the wildcard sets eol=lf on every tracked path as configuration, so git check-attr would report lf for literally everything, pinned or not. #634's own PR body names this exact failure mode - a blanket default makes the check vacuous - and calls out repos declaring lineEndings: lf (which Blog is) as the shape where it bites. So option 3 wouldn't just cost Blog its own check-eol-pins.py, it would specifically defeat eol-coverage for the one repo whose bug caused that check to get built.

    Ruling out option 3 on that basis. Between option 1 (document -text + pins as an accepted alternative) and option 2 (record it as Blog's own driftNote), I'd now lean toward 1 given eol-coverage already exists hub-side and rewards exactly this shape - but that's still the hub's call, not mine. Leaving this open.

    One more thing worth the hub's attention while this is open: is scripts/repo_gate.py --check eol-coverage wired into Blog's own CI anywhere, or only reachable by an auditor running it from a hub checkout by hand? Blog's local checks/check-eol-pins.py runs on every PR; if eol-coverage is audit-only, the fleet now has the same logic in two places at two different fidelities (every-PR local vs. on-demand hub-side), which is its own small tidiness question once 1 vs. 2 above is settled.

  2. added
    decision
    on Sep 5, 2026
  3. ptr727 commented on Sep 7, 2026

    @ptr727
    OwnerAuthor

    Overtaken by merged work, closed with the maintainer's go-ahead 2026-09-07.

    ptr727/Blog#98 adopted text=auto eol=lf and deleted check-eol-pins.py, so the deliberate -text plus pins divergence this issue asked about no longer exists. Blog now matches the fleet default and there is nothing left to accept or reconcile.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    decision

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions