chore: keep the working copy LF on every platform - #64
Merged
Conversation
This comment has been minimized.
This comment has been minimized.
gofumpt treats a CRLF file as unformatted. On a Windows checkout with core.autocrlf=true that is every Go file in the repository, so `make lint` and `make fmt-check` fail with 93 issues that have nothing to do with the code, and `make fmt` has to be re-run after every checkout. The index is already LF -- renormalizing changes no content -- so this only pins what a checkout writes to disk. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
kukv
force-pushed
the
chore/gitattributes-go-eol
branch
from
September 7, 2026 21:58
6ff680e to
1d03791
Compare
Code Metrics Report
Reported by octocov |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
なぜ
Windows で
core.autocrlf=trueのままチェックアウトすると、.golden以外の全ファイルが CRLF になる。実測した影響は次のとおり。.go(94 ファイル)— 実害あり。 gofumpt は CRLF を「整形されていない」と判定するため、make lintとmake fmt-checkが全ファイルで落ちる。make fmtを毎回挟めば回避できるが、git checkoutやgit stashのたび再発する。.sh(2 ファイル)— 壊れうる。.claude/hooks/の PreToolUse フック。CRLF のシェルスクリプトは$'\r': command not foundを起こす。現状は落ちなかったが、readやヒアドキュメントが入れば壊れる。静かに動かなくなる種類のもの。testdata(15 ファイル)— 潜在的。 現在 883 テストは CRLF のまま通っており、パーサは改行に寛容。ただしこれは偶然で、行分割に敏感な処理が入ると「ローカルは通るが CI は落ちる」形で出る。
何をしたか
作業コピーを全プラットフォームで LF に固定し、バイト比較が要るものだけ例外にした。
text=autoはバイナリを自動判別するのでLICENSEなどに影響しない。.gitattributesは後の行が勝つため、-textの 2 つが例外として効く。internal/gh/cli/testdata/**を-textにしたのは、これが GitHub から録ったレスポンスそのものだから。改行を変換するのは「録ったファイルの編集」にあたる(.claude/rules/testing.md)。.goldenを-textにしているのと同じ理屈。インデックスは元から全て LF なので、この PR の差分は
.gitattributesの 11 行だけで、既存ファイルは 1 バイトも変わっていない。確認
.golden以外に CRLF が 0 件git statusが clean(べき等)make fmtを挟まずにmake checkが終了コード 0CI(Linux)は元から LF なので挙動は変わらない。効くのは Windows のチェックアウトだけ。
🤖 Generated with Claude Code