All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] Move Git for Windows' system config to its top-level directory's etc/
@ 2021-06-22 10:46 Johannes Schindelin via GitGitGadget
  2021-06-22 10:46 ` [PATCH 1/3] mingw: move Git for Windows' system config where users expect it Johannes Schindelin via GitGitGadget
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Johannes Schindelin via GitGitGadget @ 2021-06-22 10:46 UTC (permalink / raw)
  To: git; +Cc: Johannes Schindelin

Implementation details let Git for Windows' git.exe live in /mingw64/bin
(that is the pseudo-Unix path, of course, the real Windows path will be
prefixed by the actual installation location). This resulted in the awkward
location of the system config in C:\Program Files\Git\mingw64\etc\gitconfig,
and that is what Git for Windows v2.x used for a few years.

A much more natural location, however, is the same path without that mingw64
infix. Therefore, the Git for Windows project switched (back) to that
location for a while now.

It is time to bring that change into core Git.

Dennis Ameling (1):
  cmake(windows): set correct path to the system Git config

Johannes Schindelin (2):
  mingw: move Git for Windows' system config where users expect it
  config: normalize the path of the system gitconfig

 config.c                            |  7 ++++---
 config.mak.uname                    | 10 ++++++++++
 contrib/buildsystems/CMakeLists.txt | 11 +++++++----
 3 files changed, 21 insertions(+), 7 deletions(-)


base-commit: 670b81a890388c60b7032a4f5b879f2ece8c4558
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-984%2Fdscho%2Fmove-gfw-system-config-to-top-level-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-984/dscho/move-gfw-system-config-to-top-level-v1
Pull-Request: https://github.com/gitgitgadget/git/pull/984
-- 
gitgitgadget

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/3] mingw: move Git for Windows' system config where users expect it
  2021-06-22 10:46 [PATCH 0/3] Move Git for Windows' system config to its top-level directory's etc/ Johannes Schindelin via GitGitGadget
@ 2021-06-22 10:46 ` Johannes Schindelin via GitGitGadget
  2021-06-22 10:46 ` [PATCH 2/3] cmake(windows): set correct path to the system Git config Dennis Ameling via GitGitGadget
  2021-06-22 10:46 ` [PATCH 3/3] config: normalize the path of the system gitconfig Johannes Schindelin via GitGitGadget
  2 siblings, 0 replies; 4+ messages in thread
From: Johannes Schindelin via GitGitGadget @ 2021-06-22 10:46 UTC (permalink / raw)
  To: git; +Cc: Johannes Schindelin, Johannes Schindelin

From: Johannes Schindelin <johannes.schindelin@gmx.de>

Git for Windows' prefix is `/mingw64/` (or `/mingw32/` for 32-bit
versions), therefore the system config is located at the clunky location
`C:\Program Files\Git\mingw64\etc\gitconfig`.

This moves the system config into a more logical location: the `mingw64`
part of `C:\Program Files\Git\mingw64\etc\gitconfig` never made sense,
as it is a mere implementation detail. Let's skip the `mingw64` part and
move this to `C:\Program Files\Git\etc\gitconfig`.

Side note: in the rare (and not recommended) case a user chooses to
install 32-bit Git for Windows on a 64-bit system, the path will of
course be `C:\Program Files (x86)\Git\etc\gitconfig`.

Background: During the Git for Windows v1.x days, the system config was
located at `C:\Program Files (x86)\Git\etc\gitconfig`. With Git for
Windows v2.x, it moved to `C:\Program Files\Git\mingw64\gitconfig` (or
`C:\Program Files (x86)\Git\mingw32\gitconfig`). Rather than fixing it
back then, we tried to introduce a "Windows-wide" config, but that never
caught on.

Likewise, we move the system `gitattributes` into the same directory.

Obviously, we are cautious to do this only for the known install
locations `/mingw64` and `/mingw32`; If anybody wants to override that
while building their version of Git (e.g. via `make prefix=$HOME`), we
leave the default location of the system config and gitattributes alone.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 config.mak.uname | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/config.mak.uname b/config.mak.uname
index cb443b4e023a..0587a23c1cb1 100644
--- a/config.mak.uname
+++ b/config.mak.uname
@@ -437,6 +437,11 @@ ifeq ($(uname_S),Windows)
 	NO_POSIX_GOODIES = UnfortunatelyYes
 	NATIVE_CRLF = YesPlease
 	DEFAULT_HELP_FORMAT = html
+ifeq (/mingw64,$(subst 32,64,$(prefix)))
+	# Move system config into top-level /etc/
+	ETC_GITCONFIG = ../etc/gitconfig
+	ETC_GITATTRIBUTES = ../etc/gitattributes
+endif
 
 	CC = compat/vcbuild/scripts/clink.pl
 	AR = compat/vcbuild/scripts/lib.pl
@@ -671,6 +676,11 @@ else
 		USE_LIBPCRE= YesPlease
 		NO_CURL =
 		USE_NED_ALLOCATOR = YesPlease
+		ifeq (/mingw64,$(subst 32,64,$(prefix)))
+			# Move system config into top-level /etc/
+			ETC_GITCONFIG = ../etc/gitconfig
+			ETC_GITATTRIBUTES = ../etc/gitattributes
+		endif
 	else
 		COMPAT_CFLAGS += -D__USE_MINGW_ANSI_STDIO
 		NO_CURL = YesPlease
-- 
gitgitgadget


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/3] cmake(windows): set correct path to the system Git config
  2021-06-22 10:46 [PATCH 0/3] Move Git for Windows' system config to its top-level directory's etc/ Johannes Schindelin via GitGitGadget
  2021-06-22 10:46 ` [PATCH 1/3] mingw: move Git for Windows' system config where users expect it Johannes Schindelin via GitGitGadget
@ 2021-06-22 10:46 ` Dennis Ameling via GitGitGadget
  2021-06-22 10:46 ` [PATCH 3/3] config: normalize the path of the system gitconfig Johannes Schindelin via GitGitGadget
  2 siblings, 0 replies; 4+ messages in thread
From: Dennis Ameling via GitGitGadget @ 2021-06-22 10:46 UTC (permalink / raw)
  To: git; +Cc: Johannes Schindelin, Dennis Ameling

From: Dennis Ameling <dennis@dennisameling.com>

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>
---
 contrib/buildsystems/CMakeLists.txt | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt
index a87841340e6a..bdc5ab58d038 100644
--- a/contrib/buildsystems/CMakeLists.txt
+++ b/contrib/buildsystems/CMakeLists.txt
@@ -204,8 +204,6 @@ list(APPEND compat_SOURCES sha1dc_git.c sha1dc/sha1.c sha1dc/ubc_check.c block-s
 
 
 add_compile_definitions(PAGER_ENV="LESS=FRX LV=-c"
-			ETC_GITATTRIBUTES="etc/gitattributes"
-			ETC_GITCONFIG="etc/gitconfig"
 			GIT_EXEC_PATH="libexec/git-core"
 			GIT_LOCALE_PATH="share/locale"
 			GIT_MAN_PATH="share/man"
@@ -220,10 +218,15 @@ add_compile_definitions(PAGER_ENV="LESS=FRX LV=-c"
 
 if(WIN32)
 	set(FALLBACK_RUNTIME_PREFIX /mingw64)
-	add_compile_definitions(FALLBACK_RUNTIME_PREFIX="${FALLBACK_RUNTIME_PREFIX}")
+	# Move system config into top-level /etc/
+	add_compile_definitions(FALLBACK_RUNTIME_PREFIX="${FALLBACK_RUNTIME_PREFIX}"
+		ETC_GITATTRIBUTES="../etc/gitattributes"
+		ETC_GITCONFIG="../etc/gitconfig")
 else()
 	set(FALLBACK_RUNTIME_PREFIX /home/$ENV{USER})
-	add_compile_definitions(FALLBACK_RUNTIME_PREFIX="${FALLBACK_RUNTIME_PREFIX}")
+	add_compile_definitions(FALLBACK_RUNTIME_PREFIX="${FALLBACK_RUNTIME_PREFIX}"
+		ETC_GITATTRIBUTES="etc/gitattributes"
+		ETC_GITCONFIG="etc/gitconfig")
 endif()
 
 
-- 
gitgitgadget


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 3/3] config: normalize the path of the system gitconfig
  2021-06-22 10:46 [PATCH 0/3] Move Git for Windows' system config to its top-level directory's etc/ Johannes Schindelin via GitGitGadget
  2021-06-22 10:46 ` [PATCH 1/3] mingw: move Git for Windows' system config where users expect it Johannes Schindelin via GitGitGadget
  2021-06-22 10:46 ` [PATCH 2/3] cmake(windows): set correct path to the system Git config Dennis Ameling via GitGitGadget
@ 2021-06-22 10:46 ` Johannes Schindelin via GitGitGadget
  2 siblings, 0 replies; 4+ messages in thread
From: Johannes Schindelin via GitGitGadget @ 2021-06-22 10:46 UTC (permalink / raw)
  To: git; +Cc: Johannes Schindelin, Johannes Schindelin

From: Johannes Schindelin <johannes.schindelin@gmx.de>

Git for Windows is compiled with a runtime prefix, and that runtime
prefix is typically `C:/Program Files/Git/mingw64`. As we want the
system gitconfig to live in the sibling directory `etc`, we define the
relative path as `../etc/gitconfig`.

However, as reported by Philip Oakley, the output of `git config
--show-origin --system -l` looks rather ugly, as it shows the path as
`file:C:/Program Files/Git/mingw64/../etc/gitconfig`, i.e. with the
`mingw64/../` part.

By normalizing the path, we get a prettier path.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 config.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/config.c b/config.c
index f9c400ad3062..3cd10aeb9028 100644
--- a/config.c
+++ b/config.c
@@ -1833,9 +1833,10 @@ static int git_config_from_blob_ref(config_fn_t fn,
 char *git_system_config(void)
 {
 	char *system_config = xstrdup_or_null(getenv("GIT_CONFIG_SYSTEM"));
-	if (system_config)
-		return system_config;
-	return system_path(ETC_GITCONFIG);
+	if (!system_config)
+		system_config = system_path(ETC_GITCONFIG);
+	normalize_path_copy(system_config, system_config);
+	return system_config;
 }
 
 void git_global_config(char **user_out, char **xdg_out)
-- 
gitgitgadget

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-06-22 10:47 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-22 10:46 [PATCH 0/3] Move Git for Windows' system config to its top-level directory's etc/ Johannes Schindelin via GitGitGadget
2021-06-22 10:46 ` [PATCH 1/3] mingw: move Git for Windows' system config where users expect it Johannes Schindelin via GitGitGadget
2021-06-22 10:46 ` [PATCH 2/3] cmake(windows): set correct path to the system Git config Dennis Ameling via GitGitGadget
2021-06-22 10:46 ` [PATCH 3/3] config: normalize the path of the system gitconfig Johannes Schindelin via GitGitGadget

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.