{"thread":{"id":"55985","subject":"[PATCH 2/3] cmake(windows): set correct path to the system Git config","startedAt":"2021-06-22T10:46:56Z","lastAt":"2021-06-22T10:47:03Z","messageCount":4,"participants":["Dennis Ameling via GitGitGadget","Johannes Schindelin via GitGitGadget"],"isPatch":true,"patchVersion":1,"patchTotal":3},"messages":[{"id":"428189","messageId":"e322e806639ec614b2550a69f3bd84c1ef16a698.1624358809.git.gitgitgadget@gmail.com","threadId":"55985","inReplyTo":"pull.984.git.1624358809.gitgitgadget@gmail.com","subject":"[PATCH 2/3] cmake(windows): set correct path to the system Git config","fromName":"Dennis Ameling via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2021-06-22T10:46:47Z","receivedAt":"2021-06-22T10:46:56Z","isPatch":true,"sender":{"key":"name:Dennis Ameling","avatar":null},"body":"From: Dennis Ameling <dennis@dennisameling.com>\n\nCurrently, when Git for Windows is built with CMake, the system Git config is\nexpected in a different location than when building via `make`: the former\nexpects it to be in `<runtime-prefix>/mingw64/etc/gitconfig`, the latter in\n`<runtime-prefix>/etc/gitconfig`.\n\nBecause of this, things like `git clone` do not work correctly (because cURL is\nno longer able to find its certificate bundle that it needs to validate HTTPS\ncertificates). See the full bug report and discussion here:\nhttps://github.com/git-for-windows/git/issues/3071#issuecomment-789261386.\n\nThis commit aligns the CMake-based build by mimicking what is already done in\n`config.mak.uname`.\n\nThis closes https://github.com/git-for-windows/git/issues/3071.\n\nSigned-off-by: Dennis Ameling <dennis@dennisameling.com>\n---\n contrib/buildsystems/CMakeLists.txt | 11 +++++++----\n 1 file changed, 7 insertions(+), 4 deletions(-)\n\ndiff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt\nindex a87841340e6a..bdc5ab58d038 100644\n--- a/contrib/buildsystems/CMakeLists.txt\n+++ b/contrib/buildsystems/CMakeLists.txt\n@@ -204,8 +204,6 @@ list(APPEND compat_SOURCES sha1dc_git.c sha1dc/sha1.c sha1dc/ubc_check.c block-s\n \n \n add_compile_definitions(PAGER_ENV=\"LESS=FRX LV=-c\"\n-\t\t\tETC_GITATTRIBUTES=\"etc/gitattributes\"\n-\t\t\tETC_GITCONFIG=\"etc/gitconfig\"\n \t\t\tGIT_EXEC_PATH=\"libexec/git-core\"\n \t\t\tGIT_LOCALE_PATH=\"share/locale\"\n \t\t\tGIT_MAN_PATH=\"share/man\"\n@@ -220,10 +218,15 @@ add_compile_definitions(PAGER_ENV=\"LESS=FRX LV=-c\"\n \n if(WIN32)\n \tset(FALLBACK_RUNTIME_PREFIX /mingw64)\n-\tadd_compile_definitions(FALLBACK_RUNTIME_PREFIX=\"${FALLBACK_RUNTIME_PREFIX}\")\n+\t# Move system config into top-level /etc/\n+\tadd_compile_definitions(FALLBACK_RUNTIME_PREFIX=\"${FALLBACK_RUNTIME_PREFIX}\"\n+\t\tETC_GITATTRIBUTES=\"../etc/gitattributes\"\n+\t\tETC_GITCONFIG=\"../etc/gitconfig\")\n else()\n \tset(FALLBACK_RUNTIME_PREFIX /home/$ENV{USER})\n-\tadd_compile_definitions(FALLBACK_RUNTIME_PREFIX=\"${FALLBACK_RUNTIME_PREFIX}\")\n+\tadd_compile_definitions(FALLBACK_RUNTIME_PREFIX=\"${FALLBACK_RUNTIME_PREFIX}\"\n+\t\tETC_GITATTRIBUTES=\"etc/gitattributes\"\n+\t\tETC_GITCONFIG=\"etc/gitconfig\")\n endif()\n \n \n-- \ngitgitgadget\n\n"},{"id":"428190","messageId":"pull.984.git.1624358809.gitgitgadget@gmail.com","threadId":"55985","inReplyTo":null,"subject":"[PATCH 0/3] Move Git for Windows' system config to its top-level directory's etc/","fromName":"Johannes Schindelin via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2021-06-22T10:46:45Z","receivedAt":"2021-06-22T10:46:59Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Implementation details let Git for Windows' git.exe live in /mingw64/bin\n(that is the pseudo-Unix path, of course, the real Windows path will be\nprefixed by the actual installation location). This resulted in the awkward\nlocation of the system config in C:\\Program Files\\Git\\mingw64\\etc\\gitconfig,\nand that is what Git for Windows v2.x used for a few years.\n\nA much more natural location, however, is the same path without that mingw64\ninfix. Therefore, the Git for Windows project switched (back) to that\nlocation for a while now.\n\nIt is time to bring that change into core Git.\n\nDennis Ameling (1):\n  cmake(windows): set correct path to the system Git config\n\nJohannes Schindelin (2):\n  mingw: move Git for Windows' system config where users expect it\n  config: normalize the path of the system gitconfig\n\n config.c                            |  7 ++++---\n config.mak.uname                    | 10 ++++++++++\n contrib/buildsystems/CMakeLists.txt | 11 +++++++----\n 3 files changed, 21 insertions(+), 7 deletions(-)\n\n\nbase-commit: 670b81a890388c60b7032a4f5b879f2ece8c4558\nPublished-As: https://github.com/gitgitgadget/git/releases/tag/pr-984%2Fdscho%2Fmove-gfw-system-config-to-top-level-v1\nFetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-984/dscho/move-gfw-system-config-to-top-level-v1\nPull-Request: https://github.com/gitgitgadget/git/pull/984\n-- \ngitgitgadget\n"},{"id":"428191","messageId":"01aa77d9acbbdbaf90937e14f276e981e77568c3.1624358809.git.gitgitgadget@gmail.com","threadId":"55985","inReplyTo":"pull.984.git.1624358809.gitgitgadget@gmail.com","subject":"[PATCH 3/3] config: normalize the path of the system gitconfig","fromName":"Johannes Schindelin via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2021-06-22T10:46:48Z","receivedAt":"2021-06-22T10:47:01Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"From: Johannes Schindelin <johannes.schindelin@gmx.de>\n\nGit for Windows is compiled with a runtime prefix, and that runtime\nprefix is typically `C:/Program Files/Git/mingw64`. As we want the\nsystem gitconfig to live in the sibling directory `etc`, we define the\nrelative path as `../etc/gitconfig`.\n\nHowever, as reported by Philip Oakley, the output of `git config\n--show-origin --system -l` looks rather ugly, as it shows the path as\n`file:C:/Program Files/Git/mingw64/../etc/gitconfig`, i.e. with the\n`mingw64/../` part.\n\nBy normalizing the path, we get a prettier path.\n\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n---\n config.c | 7 ++++---\n 1 file changed, 4 insertions(+), 3 deletions(-)\n\ndiff --git a/config.c b/config.c\nindex f9c400ad3062..3cd10aeb9028 100644\n--- a/config.c\n+++ b/config.c\n@@ -1833,9 +1833,10 @@ static int git_config_from_blob_ref(config_fn_t fn,\n char *git_system_config(void)\n {\n \tchar *system_config = xstrdup_or_null(getenv(\"GIT_CONFIG_SYSTEM\"));\n-\tif (system_config)\n-\t\treturn system_config;\n-\treturn system_path(ETC_GITCONFIG);\n+\tif (!system_config)\n+\t\tsystem_config = system_path(ETC_GITCONFIG);\n+\tnormalize_path_copy(system_config, system_config);\n+\treturn system_config;\n }\n \n void git_global_config(char **user_out, char **xdg_out)\n-- \ngitgitgadget\n"},{"id":"428192","messageId":"996316dc382dbe164ae40e8bcf2e61efa3581b62.1624358809.git.gitgitgadget@gmail.com","threadId":"55985","inReplyTo":"pull.984.git.1624358809.gitgitgadget@gmail.com","subject":"[PATCH 1/3] mingw: move Git for Windows' system config where users expect it","fromName":"Johannes Schindelin via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2021-06-22T10:46:46Z","receivedAt":"2021-06-22T10:47:03Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"From: Johannes Schindelin <johannes.schindelin@gmx.de>\n\nGit for Windows' prefix is `/mingw64/` (or `/mingw32/` for 32-bit\nversions), therefore the system config is located at the clunky location\n`C:\\Program Files\\Git\\mingw64\\etc\\gitconfig`.\n\nThis moves the system config into a more logical location: the `mingw64`\npart of `C:\\Program Files\\Git\\mingw64\\etc\\gitconfig` never made sense,\nas it is a mere implementation detail. Let's skip the `mingw64` part and\nmove this to `C:\\Program Files\\Git\\etc\\gitconfig`.\n\nSide note: in the rare (and not recommended) case a user chooses to\ninstall 32-bit Git for Windows on a 64-bit system, the path will of\ncourse be `C:\\Program Files (x86)\\Git\\etc\\gitconfig`.\n\nBackground: During the Git for Windows v1.x days, the system config was\nlocated at `C:\\Program Files (x86)\\Git\\etc\\gitconfig`. With Git for\nWindows v2.x, it moved to `C:\\Program Files\\Git\\mingw64\\gitconfig` (or\n`C:\\Program Files (x86)\\Git\\mingw32\\gitconfig`). Rather than fixing it\nback then, we tried to introduce a \"Windows-wide\" config, but that never\ncaught on.\n\nLikewise, we move the system `gitattributes` into the same directory.\n\nObviously, we are cautious to do this only for the known install\nlocations `/mingw64` and `/mingw32`; If anybody wants to override that\nwhile building their version of Git (e.g. via `make prefix=$HOME`), we\nleave the default location of the system config and gitattributes alone.\n\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n---\n config.mak.uname | 10 ++++++++++\n 1 file changed, 10 insertions(+)\n\ndiff --git a/config.mak.uname b/config.mak.uname\nindex cb443b4e023a..0587a23c1cb1 100644\n--- a/config.mak.uname\n+++ b/config.mak.uname\n@@ -437,6 +437,11 @@ ifeq ($(uname_S),Windows)\n \tNO_POSIX_GOODIES = UnfortunatelyYes\n \tNATIVE_CRLF = YesPlease\n \tDEFAULT_HELP_FORMAT = html\n+ifeq (/mingw64,$(subst 32,64,$(prefix)))\n+\t# Move system config into top-level /etc/\n+\tETC_GITCONFIG = ../etc/gitconfig\n+\tETC_GITATTRIBUTES = ../etc/gitattributes\n+endif\n \n \tCC = compat/vcbuild/scripts/clink.pl\n \tAR = compat/vcbuild/scripts/lib.pl\n@@ -671,6 +676,11 @@ else\n \t\tUSE_LIBPCRE= YesPlease\n \t\tNO_CURL =\n \t\tUSE_NED_ALLOCATOR = YesPlease\n+\t\tifeq (/mingw64,$(subst 32,64,$(prefix)))\n+\t\t\t# Move system config into top-level /etc/\n+\t\t\tETC_GITCONFIG = ../etc/gitconfig\n+\t\t\tETC_GITATTRIBUTES = ../etc/gitattributes\n+\t\tendif\n \telse\n \t\tCOMPAT_CFLAGS += -D__USE_MINGW_ANSI_STDIO\n \t\tNO_CURL = YesPlease\n-- \ngitgitgadget\n\n"}]}