Skip to content

fix: renormalize gradlew.bat so a fresh clone is clean - #33

Merged
jamesarich merged 1 commit into
mainfrom
fix/renormalize-gradlew-bat
Jul 31, 2026
Merged

fix: renormalize gradlew.bat so a fresh clone is clean#33
jamesarich merged 1 commit into
mainfrom
fix/renormalize-gradlew-bat

Conversation

@jamesarich

@jamesarich jamesarich commented Jul 31, 2026

Copy link
Copy Markdown
Collaborator

The problem

git status is dirty the instant you clone, before touching anything:

$ git clone https://github.com/meshtastic/kzstd && cd kzstd && git status --porcelain
 M gradlew.bat

.gitattributes declares gradlew.bat text eol=crlf, so git expects the blob stored in the repository to be LF and the working-tree copy to be CRLF. The committed blob is CRLF instead — it predates the attribute. So git checks the file out as-is, re-hashes it through the clean filter to LF, and reports a modification that can never be resolved by editing.

git ls-files --eol names it directly:

i/crlf  w/crlf  attr/text eol=crlf     gradlew.bat      # before — index should be i/lf

Not a local configuration problem. I checked fresh clones under both core.autocrlf=false and core.autocrlf=input; both are affected, because a path attribute overrides autocrlf either way. Every clone of this repo has this.

The fix

git add --renormalize gradlew.bat. The blob becomes LF, the checkout stays CRLF as the attribute intends:

i/lf    w/crlf  attr/text eol=crlf     gradlew.bat      # after

The diff is 82 lines each way and is entirely line endingsgit diff --ignore-cr-at-eol is empty. Windows users are unaffected: the working-tree copy is still CRLF, which is what eol=crlf guarantees and what cmd.exe needs.

Verification

Cloned the branch fresh: git status --porcelain is empty, and stays empty after deleting and re-checking-out the file.

Why it's worth fixing

Beyond the papercut, a permanently-dirty tracked file silently suppresses tooling that declines to act on a dirty tree — release scripts, git bisect, and in my case a multi-repo sync that skips repos with modified tracked files, so it skipped this one indefinitely.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Chores
    • Standardized formatting and line endings in the Gradle startup script without changing its behavior.

`.gitattributes` declares `gradlew.bat text eol=crlf`, so git expects the blob
stored in the repository to be LF and the working-tree copy to be CRLF. The
committed blob is CRLF instead — it predates the attribute — so on every clone
git checks the file out as-is, re-hashes it through the clean filter to LF, and
reports it modified.

The result is that `git status` is dirty the instant you clone, before touching
anything:

    $ git clone … && cd kzstd && git status --porcelain
     M gradlew.bat

Verified this is not a local configuration problem: fresh clones with
core.autocrlf=false and core.autocrlf=input are both affected, because a path
attribute overrides autocrlf either way. `git ls-files --eol` names the cause
directly — `i/crlf w/crlf attr/text` where an LF index blob is expected.

`git add --renormalize` fixes it: the blob becomes LF, the checkout stays CRLF
as the attribute intends, and the tree is clean and stays clean across
subsequent checkouts. The diff is 82 lines each way and entirely line endings;
`git diff --ignore-cr-at-eol` is empty.

Beyond the papercut, a permanently-dirty tracked file suppresses real tooling:
anything that declines to act on a dirty tree — release scripts, bisect, and in
our case a workspace sync that skips repos with modified tracked files — skips
this repo forever.

Signed-off-by: James Rich <james.a.rich@gmail.com>
@coderabbitai

coderabbitai Bot commented Jul 31, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 0c70b275-e113-4f91-a647-36eedd5b4415

📥 Commits

Reviewing files that changed from the base of the PR and between e3d6d77 and c8c35d7.

📒 Files selected for processing (1)
  • gradlew.bat

📝 Walkthrough

Walkthrough

The Windows Gradle wrapper script was converted to normalized line endings. Its startup, Java discovery, error handling, execution, and exit-status propagation remain unchanged.

Changes

Gradle wrapper normalization

Layer / File(s) Summary
Normalize Windows wrapper formatting
gradlew.bat
The script’s line endings and formatting were normalized while preserving executable logic and control flow.

Estimated code review effort: 1 (Trivial) | ~3 minutes

Poem

I’m a bunny with a wrapper so neat,
Normalized lines make the script complete.
Gradle still hops,
Java still stops,
Same exit code, same little beat!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the line-ending normalization of gradlew.bat to keep fresh clones clean.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@jamesarich
jamesarich added this pull request to the merge queue Jul 31, 2026
Merged via the queue into main with commit 87fe98c Jul 31, 2026
8 checks passed
@jamesarich
jamesarich deleted the fix/renormalize-gradlew-bat branch July 31, 2026 01:57
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