fix: support Windows ARM64 (clangarm64) in install.cmd - #1259
Conversation
Git for Windows on ARM64 uses a `clangarm64` directory instead of `mingw64`. The installer now auto-detects `clangarm64` when `mingw64` is not present, so it works out of the box on ARM64 Windows machines without requiring the user to manually supply the path. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR updates install.cmd to support Git for Windows on ARM64, where the installation uses a clangarm64 directory layout instead of mingw64, by detecting and accepting either directory when resolving the install prefix.
Changes:
- Extend prefix auto-detection to fall back to
clangarm64whenmingw64is not present. - Update default install path logic (
%ProgramFiles%\Git) to detectclangarm64. - Update install path validation to accept either
mingw64orclangarm64.
Comments suppressed due to low confidence (1)
install.cmd:75
- The user guidance still says the supplied path should point to the
mingw64directory, but the script now also supportsclangarm64. This can confuse ARM64 users who hit the fallback path handling.
echo Using git install path "%~1" as PREFIX, please make sure it's really a
echo path to the mingw64 directory...
echo.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
| for %%G in ("%bindir%") do set installdir=%%~dpG | ||
| set PREFIX=%installdir%mingw64 | ||
| if exist "%installdir%mingw64" ( | ||
| set PREFIX=%installdir%mingw64 | ||
| ) else if exist "%installdir%clangarm64" ( | ||
| set PREFIX=%installdir%clangarm64 |
There was a problem hiding this comment.
@AchoArnold
Would you address the issue pointed out by Copilot?
I don't know the syntax of cmd so I have to rely AI to check the code.
There was a problem hiding this comment.
@spacewander I've addressed the comment.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
When 'where git.exe' resolves to ...\mingw64\bin\git.exe or ...\clangarm64\bin\git.exe, installdir becomes the architecture directory itself. Detect that case by inspecting the leaf directory name instead of appending mingw64/clangarm64 (which produced non-existent ...\mingw64\mingw64 paths) or using ..\ segments. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
Addressed the Copilot feedback in 59817ef. The PATH auto-detection now inspects the leaf directory name of Verified all four PATH layouts resolve correctly with no duplicated segments:
|
|
@AchoArnold |
* fix: support Windows ARM64 (clangarm64) in install.cmd Git for Windows on ARM64 uses a `clangarm64` directory instead of `mingw64`. The installer now auto-detects `clangarm64` when `mingw64` is not present, so it works out of the box on ARM64 Windows machines without requiring the user to manually supply the path. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * fix: remove trailing whitespace from install.cmd Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> * Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> * fix: correctly resolve PREFIX when git.exe is under the arch dir in PATH When 'where git.exe' resolves to ...\mingw64\bin\git.exe or ...\clangarm64\bin\git.exe, installdir becomes the architecture directory itself. Detect that case by inspecting the leaf directory name instead of appending mingw64/clangarm64 (which produced non-existent ...\mingw64\mingw64 paths) or using ..\ segments. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Problem
Git for Windows on ARM64 uses a
clangarm64directory instead ofmingw64. Runninginstall.cmdon an ARM64 Windows machine fails with:Solution
Updated
install.cmdto auto-detectclangarm64whenmingw64is not present. The changes cover all four places where the script resolves the target directory:git.exesits in PATH. It inspects the leaf directory name of the resolved install dir: ifgit.exeis found under<GitRoot>\mingw64\binor<GitRoot>\clangarm64\bin, that architecture directory is used directly; otherwise the script looks for amingw64orclangarm64subdirectory. This avoids the previously-possible non-existent...\mingw64\mingw64/...\clangarm64\clangarm64paths.%ProgramFiles%\Gitclangarm64in user-provided install pathsmingw64orclangarm64When both directories exist,
mingw64is preferred to preserve existing behavior on x86/x64 systems.Testing
Tested on Windows 11 ARM64 with Git for Windows 2.54.0 (
clangarm64layout). The installer now correctly detects and installs toC:\Program Files\Git\clangarm64without requiring the user to manually supply the path.Additionally verified that PATH auto-detection resolves the correct
PREFIXfor all four common layouts, with no duplicated or..path segments:<GitRoot>\cmd\git.exe(x64) →<GitRoot>\mingw64<GitRoot>\mingw64\bin\git.exe→<GitRoot>\mingw64<GitRoot>\cmd\git.exe(ARM64) →<GitRoot>\clangarm64<GitRoot>\clangarm64\bin\git.exe→<GitRoot>\clangarm64