Skip to content

style: restore CRLF line endings in the nn and qlearn suites - #179

Merged
danmcleran merged 1 commit into
masterfrom
fix/restore-crlf-line-endings
Aug 31, 2026
Merged

danmcleran merged 1 commit into
masterfrom
fix/restore-crlf-line-endings

Conversation

@danmcleran

Copy link
Copy Markdown
Owner

Fixes an unintended side effect of #178. My error, not a pre-existing issue.

What happened

unit_test/nn/nn_unit_test.cpp and unit_test/qlearn/qlearn_unit_test.cpp have been CRLF for their whole history. I edited them through Python's text mode, which normalizes newlines on write, silently converting both to LF.

Why it matters

The actual content change in #178 was small:

File Real change Recorded in #178
nn_unit_test.cpp +33 / -8 17,011 lines
qlearn_unit_test.cpp +7 / -10 1,959 lines

Every line counted as rewritten. That buries the real change, makes the PR unreviewable, and poisons git blame for two of the largest files in the tree.

This PR

Converts both back to CRLF. No content change — nn and qlearn build and pass unchanged. kan_unit_test.cpp was already LF and is untouched.

🤖 Generated with Claude Code

https://claude.ai/code/session_019tVgXeXCcfbHqfMjhufWzd

#178 converted unit_test/nn/nn_unit_test.cpp and
unit_test/qlearn/qlearn_unit_test.cpp from CRLF to LF as a side effect of being
edited through Python's text mode, which normalizes newlines on write. Both
files have been CRLF for their whole history.

The content change in that PR was 33 added and 8 removed lines in nn, and 7
added and 10 removed in qlearn. The recorded diff was 17011 and 1959 lines,
because every line in both files counted as rewritten. That buries the real
change, makes the PR unreviewable, and poisons git blame for two of the largest
files in the tree.

Converts both back. No content change: the suites build and pass unchanged.
kan_unit_test.cpp was already LF and is untouched.
@danmcleran
danmcleran merged commit 6c4609e into master Aug 31, 2026
24 checks passed
@danmcleran
danmcleran deleted the fix/restore-crlf-line-endings branch August 31, 2026 11:25
danmcleran added a commit that referenced this pull request Aug 31, 2026
Editing a CRLF file with a tool that normalizes newlines rewrites the whole
file. In #178 a +33/-8 change to nn_unit_test.cpp was recorded as 17,011 lines,
which buried the real change and poisoned git blame; #179 undid it by hand.
Nothing in CI catches this -- line endings do not affect compilation, so every
gate stays green while the diff is unreviewable.

This makes the mistake structurally impossible rather than a matter of who
edits next. `* text=auto` has git store LF in the repository, and the files
that are CRLF in the working tree -- the original core headers, the first
examples, the two oldest test suites, the UML sources and one dataset -- are
pinned with `text eol=crlf` so checkout still gives them CRLF. Everything added
since is LF and needs no entry.

The effect is that a tool which converts endings now produces no diff at all:
the index holds LF either way, and checkout restores the working-tree
convention. Verified by repeating the #178 mistake against these rules -- the
same operation that produced +8518/-8518 now produces nothing, and checkout
restores CRLF.

This commit therefore renormalizes what the repository stores for those files.
That is a one-time whole-file diff for each, and the last one they will have
for this reason. Checked two ways first: every staged change is line-endings
only (content compared with CR stripped), and no file's working-tree endings
change.
danmcleran added a commit that referenced this pull request Aug 31, 2026
Editing a CRLF file with a tool that normalizes newlines rewrites the whole
file. In #178 a +33/-8 change to nn_unit_test.cpp was recorded as 17,011 lines,
which buried the real change and poisoned git blame; #179 undid it by hand.
Nothing in CI catches this -- line endings do not affect compilation, so every
gate stays green while the diff is unreviewable.

This makes the mistake structurally impossible rather than a matter of who
edits next. `* text=auto` has git store LF in the repository, and the files
that are CRLF in the working tree -- the original core headers, the first
examples, the two oldest test suites, the UML sources and one dataset -- are
pinned with `text eol=crlf` so checkout still gives them CRLF. Everything added
since is LF and needs no entry.

The effect is that a tool which converts endings now produces no diff at all:
the index holds LF either way, and checkout restores the working-tree
convention. Verified by repeating the #178 mistake against these rules -- the
same operation that produced +8518/-8518 now produces nothing, and checkout
restores CRLF.

This commit therefore renormalizes what the repository stores for those files.
That is a one-time whole-file diff for each, and the last one they will have
for this reason. Checked two ways first: every staged change is line-endings
only (content compared with CR stripped), and no file's working-tree endings
change.
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.

1 participant