]> source.dussan.org Git - jgit.git/commit
Handle global git config $XDG_CONFIG_HOME/git/config 48/203248/3
authorThomas Wolf <twolf@apache.org>
Wed, 5 Jul 2023 20:21:30 +0000 (22:21 +0200)
committerMatthias Sohn <matthias.sohn@sap.com>
Mon, 28 Aug 2023 20:05:47 +0000 (22:05 +0200)
commita2f326b76200c8def03eb136811c2cb5bc304f89
tree1bf6418ffdb374968740aeb96d73185b2b0da697
parent0d5e0176127e273ba583fbdcd81826fc5053fbfc
Handle global git config $XDG_CONFIG_HOME/git/config

C git uses this alternate fallback location if the file exists and
~/.gitconfig does not. Implement this also for JGit.

If both files exist, reading behavior is as if the XDG config was
inserted between the HOME config and the system config. Writing
behaviour is different: all changes will be applied only in the HOME
config. Updates will occur in the XDG config only if the HOME config
does not exist.

This is consistent with the behavior of C git; compare [1], especially
the sections on FILES and SCOPES, and the description of the --global
option.

[1] https://git-scm.com/docs/git-config

Bug: 581875
Change-Id: I2460b9aa963fd2811ed8a5b77b05107d916f2b44
Signed-off-by: Thomas Wolf <twolf@apache.org>
org.eclipse.jgit.test/tst/org/eclipse/jgit/storage/file/UserConfigFileTest.java [new file with mode: 0644]
org.eclipse.jgit/src/org/eclipse/jgit/lib/Config.java
org.eclipse.jgit/src/org/eclipse/jgit/lib/DefaultTypedConfigGetter.java
org.eclipse.jgit/src/org/eclipse/jgit/storage/file/FileBasedConfig.java
org.eclipse.jgit/src/org/eclipse/jgit/storage/file/UserConfigFile.java [new file with mode: 0644]
org.eclipse.jgit/src/org/eclipse/jgit/util/SystemReader.java