[RFC] Possibility to choose ~/.config/git/config instead of ~/.gitconfig

9 messages, 6 authors, 2016-06-15 · open the first message on its own page

[RFC] Possibility to choose ~/.config/git/config instead of ~/.gitconfig

From: <hidden>
Date: 2016-06-15 22:53:54

Hello,

As you know, git stores its configuration in ~/.gitconfig file and in  
other hidden files at the root of the user's directory.

We would like to have a configuration directory instead of all these  
configuration files by following the XDG specification because:
- not a lot of hidden files at the root, so better view
- one directory per software in ~/.config

We would like to give to users the possibility to store configuration  
in ~/.config/git/config file.

git would store its configuration in ~/.config/git/config file if:
- this file exists,
- and ~/.gitconfig file doesn't.
Otherwise git would store its configuration in ~/.gitconfig as usual.

If you don't create ~/.config/git/config, there is no change.

What do you think about it ?

I will send you a patch today.

Thanks,

Lucien KONG,
Valentin DUPERRAY,
Huynh Khoi Nguyen NGUYEN,
Thomas NGUY,
Franck JONAS

Grenoble INP ENSIMAG

Re: [RFC] Possibility to choose ~/.config/git/config instead of ~/.gitconfig

From: Jonathan Nieder <hidden>
Date: 2016-06-15 22:53:54

Hi,

nguyenhu@minatec.inpg.fr wrote:
As you know, git stores its configuration in ~/.gitconfig file and
in other hidden files at the root of the user's directory.
[...]
git would store its configuration in ~/.config/git/config file if:
- this file exists,
- and ~/.gitconfig file doesn't.
Otherwise git would store its configuration in ~/.gitconfig as usual.
Sounds like a worthwhile goal, so I look forward to the patch. ;-)

What other hidden files at the root of the user's directory are you
talking about?

Curious,
Jonathan

Re: [RFC] Possibility to choose ~/.config/git/config instead of ~/.gitconfig

From: Hilco Wijbenga <hidden>
Date: 2016-06-15 22:53:54

On 25 May 2012 09:15,  [off-list ref] wrote:
Hello,

As you know, git stores its configuration in ~/.gitconfig file and in other
hidden files at the root of the user's directory.

We would like to have a configuration directory instead of all these
configuration files by following the XDG specification because:
- not a lot of hidden files at the root, so better view
- one directory per software in ~/.config

We would like to give to users the possibility to store configuration in
~/.config/git/config file.
This is, of course, highly OS dependent. Ironically, I'd say we need a
setting in .gitconfig for it. :-)

There is also /etc(/default|/sysconfig|)/git/config to consider
(perhaps for some settings that should be the same for everyone).
Better yet, it would be nice if at least some settings could be part
of the repository itself (whitespace handling e.g.).
git would store its configuration in ~/.config/git/config file if:
- this file exists,
- and ~/.gitconfig file doesn't.
Otherwise git would store its configuration in ~/.gitconfig as usual.

If you don't create ~/.config/git/config, there is no change.

What do you think about it ?

I will send you a patch today.

Thanks,

Lucien KONG,
Valentin DUPERRAY,
Huynh Khoi Nguyen NGUYEN,
Thomas NGUY,
Franck JONAS

Grenoble INP ENSIMAG


--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Re: [RFC] Possibility to choose ~/.config/git/config instead of ~/.gitconfig

From: Jonathan Nieder <hidden>
Date: 2016-06-15 22:53:54

Hi Hilco,

Hilco Wijbenga wrote:
This is, of course, highly OS dependent. Ironically, I'd say we need a
setting in .gitconfig for it. :-)

There is also /etc(/default|/sysconfig|)/git/config to consider
(perhaps for some settings that should be the same for everyone).
Better yet, it would be nice if at least some settings could be part
of the repository itself (whitespace handling e.g.).
The FILES section of git-config(1) might leave you happier. :)

Regarding $GIT_DIR/config, it says "The filename is of course relative
to the repository root, not the working directory.".  Is this out of
date?  (Cc-ing Peff and Duy.)

Jonathan

Re: [RFC] Possibility to choose ~/.config/git/config instead of ~/.gitconfig

From: Hilco Wijbenga <hidden>
Date: 2016-06-15 22:53:54

On 25 May 2012 10:42, Jonathan Nieder [off-list ref] wrote:
Hi Hilco,

Hilco Wijbenga wrote:
quoted
This is, of course, highly OS dependent. Ironically, I'd say we need a
setting in .gitconfig for it. :-)

There is also /etc(/default|/sysconfig|)/git/config to consider
(perhaps for some settings that should be the same for everyone).
Better yet, it would be nice if at least some settings could be part
of the repository itself (whitespace handling e.g.).
The FILES section of git-config(1) might leave you happier. :)
Indeed!
Regarding $GIT_DIR/config, it says "The filename is of course relative
to the repository root, not the working directory.".  Is this out of
date?  (Cc-ing Peff and Duy.)
I'm sure it's not. Somehow, I had gotten it in my head that this
wasn't possible. I am going to start using this right away. :-)
Thanks!

[PATCH] config doc: remove confusion about relative GIT_DIR from FILES section

From: Jonathan Nieder <hidden>
Date: 2016-06-15 22:53:54

From the FILES section of the git-config(1) manual:

	$GIT_DIR/config::
		Repository specific configuration file. (The filename is
		of course relative to the repository root, not the working
		directory.)

That's confusing because $GIT_DIR really is relative to the working
directory.

	$ GIT_DIR=.git GIT_EDITOR='pwd; echo editing'
	$ export GIT_DIR GIT_EDITOR
	$ git config --edit --local
	/home/jrn/src/git/Documentation
	editing .git/config

It turns out that the comment is a remnant from older days when the
heading said ".git/config" (which is indeed relative to the top of the
worktree).

It was only when the heading was changed to refer more precisely to
<git dir>/config (see v1.5.3.2~18, AsciiDoc tweak to avoid leading
dot, 2007-09-14) that the parenthesis stopped making sense.  Remove
it.

Signed-off-by: Jonathan Nieder <redacted>
---
Hilco Wijbenga wrote:
On 25 May 2012 10:42, Jonathan Nieder [off-list ref] wrote:
quoted
Regarding $GIT_DIR/config, it says "The filename is of course relative
to the repository root, not the working directory.".  Is this out of
date?  (Cc-ing Peff and Duy.)
I'm sure it's not.
You're right --- the current wording never made sense and is not an
example of accurate documentation going stale with later behavior
changes as I had suspected.  Sorry for the noise.

Thanks,
Jonathan

 Documentation/git-config.txt |    4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/Documentation/git-config.txt b/Documentation/git-config.txt
index 3f5d216a..d9463cb3 100644
--- a/Documentation/git-config.txt
+++ b/Documentation/git-config.txt
@@ -198,9 +198,7 @@ If not set explicitly with '--file', there are three files where
 'git config' will search for configuration options:
 
 $GIT_DIR/config::
-	Repository specific configuration file. (The filename is
-	of course relative to the repository root, not the working
-	directory.)
+	Repository specific configuration file.
 
 ~/.gitconfig::
 	User-specific configuration file. Also called "global"
-- 
1.7.10

Re: [PATCH] config doc: remove confusion about relative GIT_DIR from FILES section

From: Jeff King <hidden>
Date: 2016-06-15 22:53:54

On Fri, May 25, 2012 at 01:12:04PM -0500, Jonathan Nieder wrote:
From the FILES section of the git-config(1) manual:

	$GIT_DIR/config::
		Repository specific configuration file. (The filename is
		of course relative to the repository root, not the working
		directory.)

That's confusing because $GIT_DIR really is relative to the working
directory.

	$ GIT_DIR=.git GIT_EDITOR='pwd; echo editing'
	$ export GIT_DIR GIT_EDITOR
	$ git config --edit --local
	/home/jrn/src/git/Documentation
	editing .git/config

It turns out that the comment is a remnant from older days when the
heading said ".git/config" (which is indeed relative to the top of the
worktree).

It was only when the heading was changed to refer more precisely to
<git dir>/config (see v1.5.3.2~18, AsciiDoc tweak to avoid leading
dot, 2007-09-14) that the parenthesis stopped making sense.  Remove
it.
Thanks for digging in the history for the answer.
quoted hunk
diff --git a/Documentation/git-config.txt b/Documentation/git-config.txt
index 3f5d216a..d9463cb3 100644
--- a/Documentation/git-config.txt
+++ b/Documentation/git-config.txt
@@ -198,9 +198,7 @@ If not set explicitly with '--file', there are three files where
 'git config' will search for configuration options:
 
 $GIT_DIR/config::
-	Repository specific configuration file. (The filename is
-	of course relative to the repository root, not the working
-	directory.)
+	Repository specific configuration file.
 
 ~/.gitconfig::
 	User-specific configuration file. Also called "global"
This makes a lot more sense to me.

Acked-by: Jeff King <redacted>

-Peff

Re: [RFC] Possibility to choose ~/.config/git/config instead of ~/.gitconfig

From: Felipe Contreras <hidden>
Date: 2016-06-15 22:53:55

On Fri, May 25, 2012 at 6:15 PM,  [off-list ref] wrote:
As you know, git stores its configuration in ~/.gitconfig file and in other
hidden files at the root of the user's directory.

We would like to have a configuration directory instead of all these
configuration files by following the XDG specification because:
- not a lot of hidden files at the root, so better view
- one directory per software in ~/.config

We would like to give to users the possibility to store configuration in
~/.config/git/config file.
I like this, but it shouldn't be "~/.config", it should be $XDG_CONFIG_HOME.

-- 
Felipe Contreras

Re: [RFC] Possibility to choose ~/.config/git/config instead of ~/.gitconfig

From: Heiko Voigt <hidden>
Date: 2016-06-15 22:53:55

Hi,

On Sat, May 26, 2012 at 12:45:52PM +0200, Felipe Contreras wrote:
On Fri, May 25, 2012 at 6:15 PM,  [off-list ref] wrote:
quoted
As you know, git stores its configuration in ~/.gitconfig file and in other
hidden files at the root of the user's directory.

We would like to have a configuration directory instead of all these
configuration files by following the XDG specification because:
- not a lot of hidden files at the root, so better view
- one directory per software in ~/.config

We would like to give to users the possibility to store configuration in
~/.config/git/config file.
I like this, but it shouldn't be "~/.config", it should be $XDG_CONFIG_HOME.
If we do that what about a fallback to .config for operating systems
that do not have XDG? E.g. Git for Windows would then also be able to
benefit from that.

Cheers Heiko
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help