Skip to content

.gitattributes に行末ポリシー (LF 統一) を追加 - #72

Merged
thawk105 merged 2 commits into
masterfrom
gitattributes-eol-lf
May 14, 2026
Merged

.gitattributes に行末ポリシー (LF 統一) を追加#72
thawk105 merged 2 commits into
masterfrom
gitattributes-eol-lf

Conversation

@thawk105

Copy link
Copy Markdown
Owner

Closes #61

変更内容

  • .gitattributes の先頭に * text=auto eol=lf を追加。ccbench は x86_64 Linux 専用なので、contributor の OS に関わらず全テキストファイルを LF に統一し、CRLF の混入を機械的に防ぐ。既存の export-ignore 行はそのまま残してある。
  • git ls-files --eol で CRLF 混入していた include/logger.hgit add --renormalize . で LF 化。.gitattributes 追加とは別コミットに分離。

CRLF 混入の診断結果

.gitattributes 追加前:

$ git ls-files --eol | awk '$1 != "i/lf" && $1 != "i/-text"'
i/crlf  w/crlf  attr/                 	include/logger.h
i/      w/      attr/                 	third_party/googletest
i/      w/      attr/                 	third_party/masstree
i/      w/      attr/                 	third_party/mimalloc
i/      w/      attr/                 	third_party/spdlog

include/logger.h のみ CRLF 混入していた (i/crlf)。third_party/* は submodule (gitlink) なので対象外。

renormalize 後:

$ git ls-files --eol | awk '$1 != "i/lf" && $1 != "i/-text"'
(テキストファイルの該当なし。残りは submodule のみ)

include/logger.h の diff は git diff -w が空 = CRLF→LF のみで内容変更なしを確認済み。

Test plan

  • cmake -B /tmp/build-61 -DCMAKE_BUILD_TYPE=Release . の configure が緑 (Configuring done / Generating done, exit 0)。
  • include/logger.h の正規化 diff が CRLF→LF のみであることを git diff -w が空であることと file コマンド (CRLF → ASCII text) で確認。

thawk105 added 2 commits May 14, 2026 06:33
ccbench targets x86_64 Linux only, so all text files should use LF.
"* text=auto eol=lf" prevents CRLF from creeping in regardless of the
platform a contributor uses.
This file was the only tracked text file with CRLF line endings, as
reported by "git ls-files --eol". Renormalized via
"git add --renormalize ." after the .gitattributes change.
@thawk105
thawk105 merged commit af050e5 into master May 14, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

.gitattributes に text=auto eol=lf を追加して CRLF 混入を機械的に防ぐ

1 participant