Skip to content

fix: support Windows ARM64 (clangarm64) in install.cmd - #1259

Merged
spacewander merged 5 commits into
tj:mainfrom
AchoArnold:fix/windows-arm64-install
Jul 8, 2026
Merged

fix: support Windows ARM64 (clangarm64) in install.cmd#1259
spacewander merged 5 commits into
tj:mainfrom
AchoArnold:fix/windows-arm64-install

Conversation

@AchoArnold

@AchoArnold AchoArnold commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

Problem

Git for Windows on ARM64 uses a clangarm64 directory instead of mingw64. Running install.cmd on an ARM64 Windows machine fails with:

No mingw64 folder found in C:\Program Files\Git.

Solution

Updated install.cmd to auto-detect clangarm64 when mingw64 is not present. The changes cover all four places where the script resolves the target directory:

  1. Auto-detection from PATH — resolves the correct architecture directory regardless of where git.exe sits in PATH. It inspects the leaf directory name of the resolved install dir: if git.exe is found under <GitRoot>\mingw64\bin or <GitRoot>\clangarm64\bin, that architecture directory is used directly; otherwise the script looks for a mingw64 or clangarm64 subdirectory. This avoids the previously-possible non-existent ...\mingw64\mingw64 / ...\clangarm64\clangarm64 paths.
  2. Default path fallback — same auto-detection for %ProgramFiles%\Git
  3. User-supplied path — recognizes clangarm64 in user-provided install paths
  4. Validation check — accepts either mingw64 or clangarm64

When both directories exist, mingw64 is preferred to preserve existing behavior on x86/x64 systems.

Testing

Tested on Windows 11 ARM64 with Git for Windows 2.54.0 (clangarm64 layout). The installer now correctly detects and installs to C:\Program Files\Git\clangarm64 without requiring the user to manually supply the path.

Additionally verified that PATH auto-detection resolves the correct PREFIX for 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

AchoArnold and others added 2 commits June 18, 2026 00:09
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>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 clangarm64 when mingw64 is not present.
  • Update default install path logic (%ProgramFiles%\Git) to detect clangarm64.
  • Update install path validation to accept either mingw64 or clangarm64.
Comments suppressed due to low confidence (1)

install.cmd:75

  • The user guidance still says the supplied path should point to the mingw64 directory, but the script now also supports clangarm64. 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.

Comment thread install.cmd Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.

Comment thread install.cmd Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.

Comment thread install.cmd Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.

Comment thread install.cmd Outdated
Comment on lines +41 to +45
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

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@spacewander I've addressed the comment.

AchoArnold and others added 2 commits July 7, 2026 10:23
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>
@AchoArnold

Copy link
Copy Markdown
Contributor Author

Addressed the Copilot feedback in 59817ef.

The PATH auto-detection now inspects the leaf directory name of installdir instead of blindly appending mingw64/clangarm64 (which produced non-existent ...\mingw64\mingw64 paths) or relying on ..\ segments. When where git.exe resolves to <GitRoot>\mingw64\bin\git.exe or <GitRoot>\clangarm64\bin\git.exe, installdir is already the architecture directory, so it is used directly as PREFIX.

Verified all four PATH layouts resolve correctly with no duplicated 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

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.

@spacewander
spacewander merged commit 7f36d37 into tj:main Jul 8, 2026
6 checks passed
@spacewander

Copy link
Copy Markdown
Collaborator

@AchoArnold
Merged. Thanks!

kdergachev pushed a commit to kdergachev/git-extras that referenced this pull request Jul 8, 2026
* 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>
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.

3 participants