fix: disable autocrlf on git clone to fix WSL issues#7916
Conversation
On WSL, git may be configured with core.autocrlf=true (Windows default), which converts LF to CRLF line endings when cloning. This causes shell scripts to fail with errors like "set: Illegal option -" because the carriage returns are interpreted as part of commands. Fixes #7913 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This PR addresses a WSL compatibility issue where git's core.autocrlf=true setting causes shell script failures by converting LF line endings to CRLF during repository cloning. The fix ensures line endings remain unchanged regardless of user git configuration.
Changes:
- Added
-c core.autocrlf=falseflag to git clone commands to disable automatic line ending conversion
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Summary of ChangesHello @jdx, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request improves compatibility for users operating within Windows Subsystem for Linux (WSL) environments. It resolves a specific problem where Git's default line ending conversion on Windows could corrupt shell scripts upon cloning, making them unexecutable. The change ensures that repositories are cloned with consistent line endings, regardless of the user's global Git configuration, thereby preventing common script execution errors. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request addresses an issue with git's core.autocrlf setting on WSL by disabling it for git clone commands. The change is correct and directly solves the stated problem for cloning. However, the fix might be incomplete as other git commands that check out files could still be affected. I've added a comment with a suggestion to make the fix more comprehensive.
| .arg("-c") | ||
| .arg("core.autocrlf=false") |
There was a problem hiding this comment.
This correctly disables autocrlf for git clone, which resolves the issue for fresh clones. However, the same line-ending problem can occur with other git commands that check out files into the working directory. To make this fix more comprehensive, I recommend applying the same logic to other relevant commands.
Specifically, consider adding -c core.autocrlf=false to:
- The
git checkoutcommand within theupdate_reffunction. - The
git submodule updatecommand within theupdate_submodulesfunction.
Move the core.autocrlf=false setting into the git_cmd! macro so it applies to all git operations (checkout, submodule update, etc.), not just clone. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
Addressed the feedback - moved the |
Hyperfine Performance
|
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
mise-2026.1.9 x -- echo |
19.9 ± 0.3 | 19.3 | 20.8 | 1.01 ± 0.03 |
mise x -- echo |
19.7 ± 0.4 | 19.0 | 22.6 | 1.00 |
mise env
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
mise-2026.1.9 env |
19.2 ± 0.8 | 18.4 | 28.6 | 1.00 |
mise env |
19.4 ± 0.6 | 18.5 | 21.0 | 1.01 ± 0.05 |
mise hook-env
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
mise-2026.1.9 hook-env |
19.4 ± 0.3 | 18.6 | 21.4 | 1.00 |
mise hook-env |
20.0 ± 0.5 | 19.1 | 22.8 | 1.03 ± 0.03 |
mise ls
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
mise-2026.1.9 ls |
16.7 ± 0.3 | 16.2 | 18.1 | 1.00 |
mise ls |
18.3 ± 0.6 | 17.3 | 22.8 | 1.09 ± 0.04 |
xtasks/test/perf
| Command | mise-2026.1.9 | mise | Variance |
|---|---|---|---|
| install (cached) | 108ms | 112ms | -3% |
| ls (cached) | 66ms | 71ms | -7% |
| bin-paths (cached) | 70ms | 74ms | -5% |
| task-ls (cached) | 285ms | -47% |
## Summary - Adds `-c core.autocrlf=false` to git clone commands to prevent CRLF line ending conversion ## Problem On WSL, git may be configured with `core.autocrlf=true` (Windows default), which converts LF to CRLF line endings when cloning repositories. This causes shell scripts (like ruby-build's `install.sh`) to fail with errors like: ``` : not found 5: install.sh: 6: set: Illegal option - ``` The carriage returns (`\r`) are interpreted as part of commands, causing the shell to fail. ## Solution Pass `-c core.autocrlf=false` to the git clone command to ensure line endings are not converted, regardless of the user's global git configuration. ## Test plan - [x] Linting passes - [ ] Test on WSL with `core.autocrlf=true` set globally Fixes jdx#7913 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Low Risk** > Low risk: this only forces `core.autocrlf=false` on the project’s `git` subprocesses to prevent CRLF conversion issues (notably on WSL), without changing repository selection or network behavior. > > **Overview** > Forces `core.autocrlf=false` on all `git` subprocess invocations via the `git_cmd!` macro, ensuring checkouts/updates don’t convert LF to CRLF based on a user’s global Git config. > > Also passes the same config explicitly to `git clone` (via `CmdLineRunner`) so newly cloned repos keep LF line endings and avoid script failures on environments like WSL. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 54c77d8. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY --> --------- Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
### 🐛 Bug Fixes - **(task)** resolve monorepo task includes relative to config file directory by @jdx in [jdx#7917](jdx#7917) - disable autocrlf on git clone to fix WSL issues by @jdx in [jdx#7916](jdx#7916) ### 📚 Documentation - **(tasks)** add bash array pattern for variadic args by @jdx in [jdx#7914](jdx#7914)
Summary
-c core.autocrlf=falseto git clone commands to prevent CRLF line ending conversionProblem
On WSL, git may be configured with
core.autocrlf=true(Windows default), which converts LF to CRLF line endings when cloning repositories. This causes shell scripts (like ruby-build'sinstall.sh) to fail with errors like:The carriage returns (
\r) are interpreted as part of commands, causing the shell to fail.Solution
Pass
-c core.autocrlf=falseto the git clone command to ensure line endings are not converted, regardless of the user's global git configuration.Test plan
core.autocrlf=trueset globallyFixes #7913
🤖 Generated with Claude Code
Note
Low Risk
Low risk: this only forces
core.autocrlf=falseon the project’sgitsubprocesses to prevent CRLF conversion issues (notably on WSL), without changing repository selection or network behavior.Overview
Forces
core.autocrlf=falseon allgitsubprocess invocations via thegit_cmd!macro, ensuring checkouts/updates don’t convert LF to CRLF based on a user’s global Git config.Also passes the same config explicitly to
git clone(viaCmdLineRunner) so newly cloned repos keep LF line endings and avoid script failures on environments like WSL.Written by Cursor Bugbot for commit 54c77d8. This will update automatically on new commits. Configure here.