Fix some annoyances with Git configuration#58
Merged
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
Updates repository Git configuration to reduce noise from accidental dotfiles and to stabilize checkout/commit behavior for Windows .bat files (notably gradlew.bat) in the presence of Dependabot and line-ending normalization.
Changes:
- Ignore all dotfiles by default, while explicitly re-including key repo configuration directories/files.
- Adjust
.gitattributesto disable EOL normalization for*.batand mark*.jaras binary.
Reviewed changes
Copilot reviewed 1 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
.gitignore |
Switches to a “ignore dotfiles by default” rule with explicit allow-listing for repo config and CI dirs. |
.gitattributes |
Disables text/EOL normalization for .bat files and adds a binary attribute for .jar files. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
The previous filter was operating under certain assumptions: 1. The gradlew.bat is stored with LF endings in repo 2. The content filter translates LF to CRLF during checkout because of the .gitattributes `text eol=crlf` 3. The content filter translates CRLF to LF when comparing to the commited version or committing Dependabot updates bypassed step (3) and commited CRLF-endings directly to the repo. Now (1) doesn't hold; (2) becomes no-op, but (3) still works and compares back-translated version with LF line endings to the store version with CRLF - this obviously doesn't match, hence the always changed file in the checkout. This commit accommodates for Dependabot's magic. Now we assume that the BAT files are stored with CRLF in the repo, and explicitly disable eol translation for those who have this enabled (otherwise they'd get LF endings because of global translation filter on Linux/macOS). This has a downside that you have to be careful not to commit LF-ended gradlew.bat, but this shouldn't be too much of an issue, and we don't build on Windows too often anyway.
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.
Exclude dotfiles from Git by default
This prevents .DS_Store and other accidental dotfiles from appearing as untracked.
Fix ever-changed
gradlew.batby removing crlf translationThe previous filter was operating under certain assumptions:
text eol=crlfDependabot updates bypassed step (3) and commited CRLF-endings directly to the repo. Now (1) doesn't hold; (2) becomes no-op, but (3) still works and compares back-translated version with LF line endings to the store version with CRLF - this obviously doesn't match, hence the always changed file in the checkout.
This commit accommodates for Dependabot's magic. Now we assume that the BAT files are stored with CRLF in the repo, and explicitly disable eol translation for those who have this enabled (otherwise they'd get LF endings because of global translation filter on Linux/macOS).
This has a downside that you have to be careful not to commit LF-ended gradlew.bat, but this shouldn't be too much of an issue, and we don't build on Windows too often anyway.