Files
gstack/.gitattributes
T
Garry Tan 76d32c803c fix(windows-ci): pin LF on extensionless executables (setup, bin/*, scripts/*)
Round 8 of windows-free-tests fixes. Round 7 cleared find-browse + most
shards; one fail left in shard 7:

  test/setup-codesign.test.ts > codesign shell snippet is syntactically valid
  expect(received).toBeTruthy() — match was null

The test extracts a bash codesign block from the `setup` file via a
\\n-anchored regex, then syntax-checks it with `bash -n`. On Windows the
regex returned null because the `setup` file was checked out with CRLF
endings — my round-2 .gitattributes only covered files matched by extension
patterns (*.md, *.sh, *.ts) and `setup` is extensionless.

Fix: extend .gitattributes with explicit rules for extensionless executables:
  setup        text eol=lf
  bin/*        text eol=lf
  **/scripts/* text eol=lf

This also LF-pins all the bash bin/ scripts (gstack-paths, gstack-slug,
gstack-codex-probe, ...) which would otherwise break with "bad interpreter"
errors on Linux if a Windows contributor accidentally committed CRLF
versions. Defense in depth.

Verified locally: `git check-attr eol setup bin/gstack-paths` reports
`eol: lf` for both. Renormalized via `git add --renormalize` so any
already-LF files in the repo stay LF after the .gitattributes change.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-28 00:12:15 -07:00

40 lines
1.4 KiB
Plaintext

# Force LF on text files we parse with `\n`-anchored regexes (frontmatter,
# YAML, markdown structure tests). Without this, Windows checkouts with
# core.autocrlf=true convert these to CRLF and break tests that match
# /^---\n...\n---/ against SKILL.md.tmpl frontmatter, etc.
*.md text eol=lf
*.tmpl text eol=lf
*.yml text eol=lf
*.yaml text eol=lf
*.json text eol=lf
*.toml text eol=lf
# Bash scripts must always use LF — CRLF in bash scripts produces bizarre
# "Bad interpreter" / "command not found" errors on Linux runners.
*.sh text eol=lf
*.bash text eol=lf
# Extensionless executables (top-level setup script + bin/gstack-* helpers).
# These are bash scripts checked into git without a `.sh` suffix. Without
# explicit eol=lf, Windows checkout with core.autocrlf=true converts them
# to CRLF and breaks both `\n`-anchored regex tests (test/setup-codesign.test.ts)
# and shebang resolution if the script is ever executed on Linux.
setup text eol=lf
bin/* text eol=lf
**/scripts/* text eol=lf
# TypeScript/JavaScript: LF for portability across the bun toolchain.
*.ts text eol=lf
*.tsx text eol=lf
*.js text eol=lf
*.mjs text eol=lf
*.cjs text eol=lf
# Binary files — never touch.
*.png binary
*.jpg binary
*.jpeg binary
*.gif binary
*.ico binary
*.pdf binary