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

[PATCH 1/3] mingw: move Git for Windows' system config where users expect it

From
Johannes Schindelin via GitGitGadget <gitgitgadget@gmail.com>
Date
Jun 22, 2021, 10:46 UTC
Message-ID
<996316dc382dbe164ae40e8bcf2e61efa3581b62.1624358809.git.gitgitgadget@gmail.com>
In-Reply-To
<pull.984.git.1624358809.gitgitgadget@gmail.com>
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
Previous: Johannes Schindelin via GitGitGadget
Message 4 of 4 in “Move Git for Windows' system config to its top-level directory's etc/”
  1. 0/3 Move Git for Windows' system config to its top-level directory's etc/Johannes Schindelin via GitGitGadget, Jun 22, 2021
  2. 2/3 cmake(windows): set correct path to the system Git configDennis Ameling via GitGitGadget, Jun 22, 2021
  3. 3/3 config: normalize the path of the system gitconfigJohannes Schindelin via GitGitGadget, Jun 22, 2021
  4. 1/3 mingw: move Git for Windows' system config where users expect itJohannes Schindelin via GitGitGadget, Jun 22, 2021

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.