Skip to content

Commit e0a0447

Browse files
dennisamelingdscho
authored andcommitted
cmake(windows): set correct path to the system Git config
Currently, when Git for Windows is built with CMake, the system Git config is expected in a different location than when building via `make`: the former expects it to be in `<runtime-prefix>/mingw64/etc/gitconfig`, the latter in `<runtime-prefix>/etc/gitconfig`. Because of this, things like `git clone` do not work correctly (because cURL is no longer able to find its certificate bundle that it needs to validate HTTPS certificates). See the full bug report and discussion here: #3071 (comment). This commit aligns the CMake-based build by mimicking what is already done in `config.mak.uname`. This closes #3071. Signed-off-by: Dennis Ameling <[email protected]>
1 parent f1f76db commit e0a0447

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

contrib/buildsystems/CMakeLists.txt

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -223,8 +223,6 @@ list(APPEND compat_SOURCES sha1dc_git.c sha1dc/sha1.c sha1dc/ubc_check.c block-s
223223

224224

225225
add_compile_definitions(PAGER_ENV="LESS=FRX LV=-c"
226-
ETC_GITATTRIBUTES="etc/gitattributes"
227-
ETC_GITCONFIG="etc/gitconfig"
228226
GIT_EXEC_PATH="libexec/git-core"
229227
GIT_LOCALE_PATH="share/locale"
230228
GIT_MAN_PATH="share/man"
@@ -239,10 +237,15 @@ add_compile_definitions(PAGER_ENV="LESS=FRX LV=-c"
239237

240238
if(WIN32)
241239
set(FALLBACK_RUNTIME_PREFIX /mingw64)
242-
add_compile_definitions(FALLBACK_RUNTIME_PREFIX="${FALLBACK_RUNTIME_PREFIX}")
240+
# Move system config into top-level /etc/
241+
add_compile_definitions(FALLBACK_RUNTIME_PREFIX="${FALLBACK_RUNTIME_PREFIX}"
242+
ETC_GITATTRIBUTES="../etc/gitattributes"
243+
ETC_GITCONFIG="../etc/gitconfig")
243244
else()
244245
set(FALLBACK_RUNTIME_PREFIX /home/$ENV{USER})
245-
add_compile_definitions(FALLBACK_RUNTIME_PREFIX="${FALLBACK_RUNTIME_PREFIX}")
246+
add_compile_definitions(FALLBACK_RUNTIME_PREFIX="${FALLBACK_RUNTIME_PREFIX}"
247+
ETC_GITATTRIBUTES="etc/gitattributes"
248+
ETC_GITCONFIG="etc/gitconfig")
246249
endif()
247250

248251

0 commit comments

Comments
 (0)