git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] cmake: support local installations of git

From
Johannes Schindelin via GitGitGadget <gitgitgadget@gmail.com>
Date
Jul 27, 2022, 09:05 UTC
Message-ID
<pull.1304.git.1658912756815.gitgitgadget@gmail.com>
From: =?UTF-8?q?Carlo=20Marcelo=20Arenas=20Bel=C3=B3n?= <carenas@gmail.com>

At least in systems where the user is local and not an administrator git will install in a subdirectory of %APPDATALOCAL%, so it makes sense to also look there for the shell needed by the cmake integration with Visual Studio.

Signed-off-by: Carlo Marcelo Arenas Belón <carenas@gmail.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
    cmake(windows): fall back to user-wide Git if there is no system Git
    
    On Windows, software is typically either installed into C:\Program
    Files, where all users can use it, or into a location inside the user's
    home directory, where only that particular user can use the software.
    
    Git for Windows strongly encourages system-wide installations, but does
    not prevent user-wide installations.
    
    When building Git via CMake, this matters because we rely on Git for
    Windows to provide the POSIX shell that is needed to run Git's generator
    scripts such as generate-cmdlist.sh. So far, we only found Git for
    Windows if it was installed system-wide, but with this here patch, we
    also find any user-wide installation.
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-1304%2Fdscho%2Fcmake-and-user-wide-g4w-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-1304/dscho/cmake-and-user-wide-g4w-v1
Pull-Request: https://github.com/gitgitgadget/git/pull/1304
 contrib/buildsystems/CMakeLists.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt
index 1b23f2440d8..2237109b57f 100644
--- a/contrib/buildsystems/CMakeLists.txt
+++ b/contrib/buildsystems/CMakeLists.txt
@@ -77,7 +77,7 @@ if(USE_VCPKG)
 	set(CMAKE_TOOLCHAIN_FILE ${VCPKG_DIR}/scripts/buildsystems/vcpkg.cmake CACHE STRING "Vcpkg toolchain file")
 endif()
 
-find_program(SH_EXE sh PATHS "C:/Program Files/Git/bin")
+find_program(SH_EXE sh PATHS "C:/Program Files/Git/bin" "$ENV{LOCALAPPDATA}/Programs/Git/bin")
 if(NOT SH_EXE)
 	message(FATAL_ERROR "sh: shell interpreter was not found in your path, please install one."
 			"On Windows, you can get it as part of 'Git for Windows' install at https://gitforwindows.org/")

base-commit: 6a475b71f8c4ce708d69fdc9317aefbde3769e25
-- 
gitgitgadget
Message 1 of 1 in “cmake: support local installations of git”
  1. cmake: support local installations of gitJohannes Schindelin via GitGitGadget, Jul 27, 2022

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.