Skip to content

Windows: add a configuration location to be shared among different Git implementations #148

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

dscho
Copy link
Member

@dscho dscho commented Feb 25, 2019

On Windows, there is no /etc/. As such, there is no "system config" per se.

In Git for Windows, we have (of course) the "system config", but it is buried in a location that is rather specific to Git for Windows: C:\Program Files\Git\mingw64\etc\gitconfig (and for 32-bit versions, it is different, as well as for Git for Windows <2.x).

Earlier, libgit2 tried to share this system config with Git for Windows, but that's not really an elegant thing to do: if Git for Windows is uninstalled, that system config is gone, for example.

So together with the libgit2 project, we came up with the idea of a "Windows-wide" config, and the most logical location with which we could come up was C:\ProgramData\Git\config.

This patch adds support for that location, and other Git implementations are encouraged to use it instead of Git for Windows' "system-wide" config.

@dscho dscho added the ready to submit Has commits that have not been submitted yet label Feb 25, 2019
@dscho
Copy link
Member Author

dscho commented Feb 25, 2019

@ethomson libgit does support this location on Windows now, does it not?

@ethomson
Copy link

It does - just to be clear about what I'm looking at, you're porting a change from the Git for Windows fork to git.git? It was like "but you already do too!" until that dawned on me.

@dscho
Copy link
Member Author

dscho commented Feb 25, 2019

It does

Thanks!

you're porting a change from the Git for Windows fork to git.git?

Yep, I am "upstreaming it", or "paying down technical debt" ;-)

@dscho dscho force-pushed the program-data-config branch 2 times, most recently from 3a7f889 to 59d7c07 Compare May 20, 2019 14:22
Between the libgit2 and the Git for Windows project, there has been a
discussion how we could share Git configuration to avoid duplication (or
worse: skew).

Earlier, libgit2 was nice enough to just re-use Git for Windows'

	C:\Program Files (x86)\Git\etc\gitconfig

but with the big changes that went into Git for Windows 2.x, there would
have been more paths to search, as there now was a 64-bit version in
addition to a 32-bit one, and the corresponding config files are
`%PROGRAMFILES%\Git\mingw64\etc` and `...\mingw32\etc`, respectively.

Worse: there are portable Git for Windows versions out there which live
in totally unrelated directories, still.

Therefore we came to a consensus to use `%PROGRAMDATA%\Git\config` as the
location for shared Git settings that are of wider interest than just Git
for Windows, read: for other Git implementations.

Of course, the configuration in `%PROGRAMDATA%\Git\config` has the
widest reach, therefore it must take the lowest precedence, i.e. Git for
Windows can still override settings in its `etc/gitconfig` file.

Git for Windows supports this since v2.5.0 (i.e. since the first v2.x),
and libgit2 supports it as of v0.28.1:
libgit2/libgit2@8c7c5fa585

Helped-by: Andreas Heiduk <[email protected]>
Signed-off-by: Johannes Schindelin <[email protected]>
@dscho
Copy link
Member Author

dscho commented Oct 27, 2019

In the meantime, Git for Windows abandoned the idea of two system gitconfigs: git-for-windows#2358.

Therefore, I will abandon this here PR.

@dscho dscho closed this Oct 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready to submit Has commits that have not been submitted yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants