Repository navigation
Expand file tree
/
Copy path.gitattributes
More file actions
61 lines (59 loc) · 2.9 KB
/
Copy path.gitattributes
File metadata and controls
61 lines (59 loc) · 2.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# ── Force LF for Unix-format files regardless of host's core.autocrlf ──
#
# Why: a developer with `git config core.autocrlf=true` on Windows will
# silently get CRLF on every text file at checkout, including shell
# scripts. Real-world hit on 2026-05-08: running scripts/restart-daemon.cmd
# (which calls `npm install` / `npm run build` / `npm link --force`)
# triggered git to refresh `bin/imcodes-launch.sh`, autocrlf converted it
# to CRLF, `git status` showed it modified, and a careless `git add .`
# would have committed CRLF into a #!/usr/bin/env bash script — bash on
# Linux/macOS treats the trailing `\r` as part of the next token and
# fails on every line ("$'\r': command not found", broken `if` tests,
# malformed variable assignments, etc.).
#
# `text eol=lf` means: treat as text in the index, force LF on checkout
# everywhere — overriding any local core.autocrlf=true setting.
*.sh text eol=lf
*.bash text eol=lf
*.mjs text eol=lf
*.cjs text eol=lf
*.mts text eol=lf
*.cts text eol=lf
# Files that have a Unix shebang interpreter — bin entries in npm
# packages and the husky hook scripts. Their extensions vary or are
# missing, so list them explicitly.
bin/* text eol=lf
.husky/_/husky.sh text eol=lf
# ── Force CRLF on Windows-only batch / VBS files regardless of host ──
#
# Why: cmd.exe parses LF inconsistently (especially inside `if (...)` blocks)
# and a `\r`-less line tail can swallow the next line as part of the previous
# command. Without this rule, git on macOS/Linux checks the file out with LF
# (matching the blob), and any test that reads the bytes directly trips a
# "bare LF — needs CRLF" assertion (see test/util/restart-daemon-cmd.test.ts).
#
# `text eol=crlf` means: treat as text in the index, force CRLF on checkout
# everywhere. The blob can still be LF — git converts on the way out.
*.cmd text eol=crlf
*.bat text eol=crlf
*.vbs text eol=crlf
*.ps1 text eol=crlf
# ── Native sources and their spec fixtures: LF everywhere ──
#
# Why: the specs under test/spec read these files and the Windows CI runner's checkout (`core.autocrlf=true`, Git for Windows'
# default) turned every LF into CRLF, so a multi-line marker such as `'UserDataFolder();\n Log("window_shown"'` was "not found"
# (job `aiDesk panel window host (Windows build)`, run 37785752309). The specs now read sources through test/helpers/read-source.ts,
# which is the real fix; this keeps the C++/header/CMake sources themselves identical on every machine (MSVC, clang and cmake all
# accept LF). No file of these kinds is stored with CRLF in the index, so nothing is renormalised.
native/**/*.cc text eol=lf
native/**/*.cpp text eol=lf
native/**/*.h text eol=lf
native/**/*.hpp text eol=lf
native/**/*.mm text eol=lf
native/**/*.m text eol=lf
native/**/*.in text eol=lf
native/**/*.cmake text eol=lf
native/**/CMakeLists.txt text eol=lf
native/**/*.manifest text eol=lf
test/spec/*.cc text eol=lf
test/spec/*.mm text eol=lf