mirror of
https://github.com/tj/git-extras.git
synced 2026-09-10 07:26:17 -04:00
fix: support Windows ARM64 (clangarm64) in install.cmd (#1259)
Some checks failed
ci / Test with Bats (push) Has been cancelled
ci / lint (push) Has been cancelled
ci / typo (push) Has been cancelled
ci / Test with Pytest (push) Has been cancelled
ci / build (macos-latest) (push) Has been cancelled
ci / build (ubuntu-latest) (push) Has been cancelled
Some checks failed
ci / Test with Bats (push) Has been cancelled
ci / lint (push) Has been cancelled
ci / typo (push) Has been cancelled
ci / Test with Pytest (push) Has been cancelled
ci / build (macos-latest) (push) Has been cancelled
ci / build (ubuntu-latest) (push) Has been cancelled
* 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>
This commit is contained in:
parent
184d37e980
commit
7f36d37283
47
install.cmd
47
install.cmd
|
|
@ -39,13 +39,34 @@ goto :defaultpath
|
||||||
rem remove the last slash
|
rem remove the last slash
|
||||||
SET bindir=%bindir:~0,-1%
|
SET bindir=%bindir:~0,-1%
|
||||||
for %%G in ("%bindir%") do set installdir=%%~dpG
|
for %%G in ("%bindir%") do set installdir=%%~dpG
|
||||||
set PREFIX=%installdir%mingw64
|
rem strip a trailing slash so we can inspect the leaf directory name
|
||||||
|
if "%installdir:~-1%"=="\" set installdir=%installdir:~0,-1%
|
||||||
|
rem git.exe found under <GitRoot>\mingw64\bin or <GitRoot>\clangarm64\bin
|
||||||
|
rem means installdir already is the architecture directory itself
|
||||||
|
for %%G in ("%installdir%") do set archdir=%%~nxG
|
||||||
|
if /I "%archdir%"=="mingw64" (
|
||||||
|
set PREFIX=%installdir%
|
||||||
|
) else if /I "%archdir%"=="clangarm64" (
|
||||||
|
set PREFIX=%installdir%
|
||||||
|
) else if exist "%installdir%\mingw64" (
|
||||||
|
set PREFIX=%installdir%\mingw64
|
||||||
|
) else if exist "%installdir%\clangarm64" (
|
||||||
|
set PREFIX=%installdir%\clangarm64
|
||||||
|
) else (
|
||||||
|
set PREFIX=%installdir%\mingw64
|
||||||
|
)
|
||||||
goto :foundprefix
|
goto :foundprefix
|
||||||
|
|
||||||
:defaultpath
|
:defaultpath
|
||||||
:: default for Git for Windows 2.x
|
:: default for Git for Windows 2.x
|
||||||
if exist "%ProgramFiles%\Git" (
|
if exist "%ProgramFiles%\Git" (
|
||||||
set PREFIX=%ProgramFiles%\Git\mingw64
|
if exist "%ProgramFiles%\Git\mingw64" (
|
||||||
|
set PREFIX=%ProgramFiles%\Git\mingw64
|
||||||
|
) else if exist "%ProgramFiles%\Git\clangarm64" (
|
||||||
|
set PREFIX=%ProgramFiles%\Git\clangarm64
|
||||||
|
) else (
|
||||||
|
set PREFIX=%ProgramFiles%\Git\mingw64
|
||||||
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
:foundprefix
|
:foundprefix
|
||||||
|
|
@ -55,9 +76,11 @@ IF NOT "%~1"=="" (
|
||||||
REM just supplying the git dir is enough...
|
REM just supplying the git dir is enough...
|
||||||
if exist "%~1\mingw64" (
|
if exist "%~1\mingw64" (
|
||||||
set PREFIX=%~1\mingw64
|
set PREFIX=%~1\mingw64
|
||||||
|
) else if exist "%~1\clangarm64" (
|
||||||
|
set PREFIX=%~1\clangarm64
|
||||||
) else (
|
) else (
|
||||||
echo Using git install path "%~1" as PREFIX, please make sure it's really a
|
echo Using git install path "%~1" as PREFIX, please make sure it's really a
|
||||||
echo path to the mingw64 directory...
|
echo path to the mingw64 or clangarm64 directory...
|
||||||
echo.
|
echo.
|
||||||
SET PREFIX=%~1
|
SET PREFIX=%~1
|
||||||
)
|
)
|
||||||
|
|
@ -72,12 +95,14 @@ set GIT_INSTALL_DIR=!GIT_INSTALL_DIR:"=!
|
||||||
IF %GIT_INSTALL_DIR:~-1%==\ SET GIT_INSTALL_DIR=%GIT_INSTALL_DIR:~0,-1%
|
IF %GIT_INSTALL_DIR:~-1%==\ SET GIT_INSTALL_DIR=%GIT_INSTALL_DIR:~0,-1%
|
||||||
|
|
||||||
if not exist "%GIT_INSTALL_DIR%\mingw64" (
|
if not exist "%GIT_INSTALL_DIR%\mingw64" (
|
||||||
echo No mingw64 folder found in %GIT_INSTALL_DIR%.
|
if not exist "%GIT_INSTALL_DIR%\clangarm64" (
|
||||||
echo.
|
echo No mingw64 or clangarm64 folder found in %GIT_INSTALL_DIR%.
|
||||||
echo Please supply a proper "Git for Windows 2.x" install path:
|
echo.
|
||||||
echo "install.cmd c:\[git-install-path]"
|
echo Please supply a proper "Git for Windows 2.x" install path:
|
||||||
set ERROR=1
|
echo "install.cmd c:\[git-install-path]"
|
||||||
goto :exit
|
set ERROR=1
|
||||||
|
goto :exit
|
||||||
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
echo Installing to %PREFIX%
|
echo Installing to %PREFIX%
|
||||||
|
|
@ -116,7 +141,7 @@ FOR /R "%GITEXTRAS%\bin" %%i in (*.*) DO (
|
||||||
TYPE "%GITEXTRAS%\helper\reset-env" >> "%PREFIX%\bin\%%~ni"
|
TYPE "%GITEXTRAS%\helper\reset-env" >> "%PREFIX%\bin\%%~ni"
|
||||||
TYPE "%GITEXTRAS%\helper\git-extra-utility" >> "%PREFIX%\bin\%%~ni"
|
TYPE "%GITEXTRAS%\helper\git-extra-utility" >> "%PREFIX%\bin\%%~ni"
|
||||||
TYPE "%GITEXTRAS%\helper\is-git-repo" >> "%PREFIX%\bin\%%~ni"
|
TYPE "%GITEXTRAS%\helper\is-git-repo" >> "%PREFIX%\bin\%%~ni"
|
||||||
|
|
||||||
REM Added /E option for installation fix on Windows 10.0.17134 and higher
|
REM Added /E option for installation fix on Windows 10.0.17134 and higher
|
||||||
MORE /E +2 "%GITEXTRAS%\bin\%%~ni" >> "%PREFIX%\bin\%%~ni"
|
MORE /E +2 "%GITEXTRAS%\bin\%%~ni" >> "%PREFIX%\bin\%%~ni"
|
||||||
)
|
)
|
||||||
|
|
@ -127,7 +152,7 @@ FOR %%i in (%COMMANDS_WITHOUT_REPO%) DO (
|
||||||
ECHO #^^!/usr/bin/env bash > "%PREFIX%\bin\%%i"
|
ECHO #^^!/usr/bin/env bash > "%PREFIX%\bin\%%i"
|
||||||
TYPE "%GITEXTRAS%\helper\reset-env" >> "%PREFIX%\bin\%%i"
|
TYPE "%GITEXTRAS%\helper\reset-env" >> "%PREFIX%\bin\%%i"
|
||||||
TYPE "%GITEXTRAS%\helper\git-extra-utility" >> "%PREFIX%\bin\%%i"
|
TYPE "%GITEXTRAS%\helper\git-extra-utility" >> "%PREFIX%\bin\%%i"
|
||||||
|
|
||||||
REM Added /E option for installation fix on Windows 10.0.17134 and higher
|
REM Added /E option for installation fix on Windows 10.0.17134 and higher
|
||||||
MORE /E +2 "%GITEXTRAS%\bin\%%i" >> "%PREFIX%\bin\%%i"
|
MORE /E +2 "%GITEXTRAS%\bin\%%i" >> "%PREFIX%\bin\%%i"
|
||||||
)
|
)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue