.gitattributes 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. # Line-ending policy — pinned so a Windows clone with core.autocrlf=true cannot
  2. # corrupt scripts on checkout.
  3. #
  4. # WHY THIS EXISTS: bash treats a trailing CR as part of the token. A CRLF
  5. # `set -euo pipefail` parses as `pipefail\r` => "invalid option name", and a CRLF
  6. # shebang makes `env` search for a program literally named `bash\r` => "No such
  7. # file or directory". Diagnosed 2026-08-07: 136 of 157 tracked *.sh files were
  8. # CRLF on disk while every git blob was clean LF, which broke
  9. # skills/fleet-ops/scripts/fleet.sh outright and therefore the whole landing gate.
  10. #
  11. # The corruption grew on every `git checkout` — files written by an agent's
  12. # Write/Edit tool are LF, files materialised by git were not. Nothing in the
  13. # repo's own history was ever wrong; only the working tree.
  14. #
  15. # DEBUGGING NOTE: MSYS `sed` silently strips CR on read and will tell you a file
  16. # is clean when it is not. Use binary-safe checks:
  17. # tr -cd '\r' < file | wc -c # non-zero => CRLF on disk
  18. # head -1 file | cat -A # shows ^M before $
  19. #
  20. # Default: normalise to LF in the repo AND in the working tree, on every platform.
  21. * text=auto eol=lf
  22. # Executed by bash — MUST be LF on disk everywhere, including Windows.
  23. *.sh text eol=lf
  24. # Executed by PowerShell. Windows PowerShell 5.1 prefers CRLF, and CRLF is
  25. # harmless to pwsh 7, so these are pinned the other way deliberately. Unrelated
  26. # to the separate WinPS 5.1 encoding issue (non-ASCII in string literals needs a
  27. # UTF-8 BOM or ASCII) — that is an encoding problem, not a line-ending one.
  28. *.ps1 text eol=crlf
  29. *.psm1 text eol=crlf
  30. *.psd1 text eol=crlf
  31. *.bat text eol=crlf
  32. *.cmd text eol=crlf
  33. # Belt and braces: never let git guess on these.
  34. *.png binary
  35. *.jpg binary
  36. *.jpeg binary
  37. *.gif binary
  38. *.ico binary
  39. *.woff binary
  40. *.woff2 binary
  41. *.pdf binary
  42. *.zip binary