fix(margin): Convert margin.sh and settings to LF, pin line endings
margin.sh and settings/*.conf carried CRLF into the repo, so sourcing
them on the SONiC DUT failed outright:
-bash: $'\r': command not found
margin.sh: line 126: syntax error near unexpected token `$'{\r''
settings/*.conf was the quieter half of the same bug: margin_init
sources them, and an unquoted assignment such as CB_I2C_CH=6 became
"6\r", so the SWB transport would have driven I2C with a malformed
channel number.
Content is unchanged - the diff is carriage returns only, and bash -n
passes on every converted file.
Add .gitattributes so this cannot come back: *.sh/*.conf/*.py/*.txt/*.md
are pinned to LF, *.ttl stays CRLF (Tera Term runs on Windows only) and
office formats are marked binary.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014RetWKFZFG1ZHcitQAyhwM
This commit is contained in:
@@ -0,0 +1,29 @@
|
|||||||
|
# =============================================================================
|
||||||
|
# 換行符政策
|
||||||
|
# -----------------------------------------------------------------------------
|
||||||
|
# 這個 repo 同時被 Windows(Tera Term 端編輯)與 SONiC/Linux(DUT 端執行)使用,
|
||||||
|
# 所以必須明確指定,不能靠各機器的 core.autocrlf。
|
||||||
|
#
|
||||||
|
# 踩過的坑:margin.sh 帶著 CRLF 進 repo,scp 到 DUT 後 bash 直接掛:
|
||||||
|
# -bash: $'\r': command not found
|
||||||
|
# syntax error near unexpected token `$'{\r''
|
||||||
|
# settings/*.conf 同樣危險 —— margin_init 是用 source 讀它們的,未加引號的
|
||||||
|
# 賦值(例如 CB_I2C_CH=6)會變成 "6\r",SWB transport 會拿著壞掉的通道號去打 I2C。
|
||||||
|
# =============================================================================
|
||||||
|
|
||||||
|
# 在 DUT / Linux 上執行或被 source 的,一律 LF
|
||||||
|
*.sh text eol=lf
|
||||||
|
*.conf text eol=lf
|
||||||
|
*.py text eol=lf
|
||||||
|
*.txt text eol=lf
|
||||||
|
*.md text eol=lf
|
||||||
|
|
||||||
|
# Tera Term macro 只在 Windows 上跑,維持 CRLF;標成 -text 讓 git 原樣保存,
|
||||||
|
# 避免對既有檔案產生大量純換行符的假 diff
|
||||||
|
*.ttl -text
|
||||||
|
|
||||||
|
# 二進位,不要做任何轉換
|
||||||
|
*.xlsx binary
|
||||||
|
*.docx binary
|
||||||
|
*.pdf binary
|
||||||
|
*.h5 binary
|
||||||
Reference in New Issue
Block a user