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: https://github.com/git-for-windows/git/issues/3071#issuecomment-789261386. This commit aligns the CMake-based build by mimicking what is already done in `config.mak.uname`. This closes https://github.com/git-for-windows/git/issues/3071. Signed-off-by: Dennis Ameling <dennis@dennisameling.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Dennis Ameling committed Jun 22, 2021 at 10:46 UTC 50101b93ca69babb389e6bdefd733ef014338d29
1 file changed +7 -4
contrib/buildsystems/CMakeLists.txt
+7 -4
@@ -204,8 +204,6 @@ list(APPEND compat_SOURCES sha1dc_git.c sha1dc/sha1.c sha1dc/ubc_check.c block-s
204
205
206 add_compile_definitions(PAGER_ENV="LESS=FRX LV=-c"
207 - ETC_GITATTRIBUTES="etc/gitattributes"
208 - ETC_GITCONFIG="etc/gitconfig"
207 GIT_EXEC_PATH="libexec/git-core"
208 GIT_LOCALE_PATH="share/locale"
209 GIT_MAN_PATH="share/man"
@@ -220,10 +218,15 @@ add_compile_definitions(PAGER_ENV="LESS=FRX LV=-c"
218
219 if(WIN32)
220 set(FALLBACK_RUNTIME_PREFIX /mingw64)
223 - add_compile_definitions(FALLBACK_RUNTIME_PREFIX="${FALLBACK_RUNTIME_PREFIX}")
221 + # Move system config into top-level /etc/
222 + add_compile_definitions(FALLBACK_RUNTIME_PREFIX="${FALLBACK_RUNTIME_PREFIX}"
223 + ETC_GITATTRIBUTES="../etc/gitattributes"
224 + ETC_GITCONFIG="../etc/gitconfig")
225 else()
226 set(FALLBACK_RUNTIME_PREFIX /home/$ENV{USER})
226 - add_compile_definitions(FALLBACK_RUNTIME_PREFIX="${FALLBACK_RUNTIME_PREFIX}")
227 + add_compile_definitions(FALLBACK_RUNTIME_PREFIX="${FALLBACK_RUNTIME_PREFIX}"
228 + ETC_GITATTRIBUTES="etc/gitattributes"
229 + ETC_GITCONFIG="etc/gitconfig")
230 endif()
231
232