{"thread":{"id":"47428","subject":"Q: rational for $XDG_CONFIG_HOME/git/config to be \"non global\" or just a bug?","startedAt":"2017-12-11T21:35:53Z","lastAt":"2017-12-18T19:57:12Z","messageCount":15,"participants":["Yaroslav Halchenko","Jonathan Nieder","Junio C Hamano","Jacob Keller","brian m. carlson","Jeff King"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"334633","messageId":"20171211211102.rrxqd6yscnd33efd@hopa.kiewit.dartmouth.edu","threadId":"47428","inReplyTo":null,"subject":"Q: rational for $XDG_CONFIG_HOME/git/config to be \"non global\" or just a bug?","fromName":"Yaroslav Halchenko","fromEmail":"yoh@onerussian.com","sentAt":"2017-12-11T21:11:02Z","receivedAt":"2017-12-11T21:35:53Z","isPatch":false,"sender":{"key":"yoh@onerussian.com","avatar":"https://gravatar.com/avatar/8901b82415ae451a83aea49409708912726e53620e3ac92320bf1f86548d97e9?d=mp&s=160"},"body":"Dear Git Gurus,\n\nWe [1] have got confused a bit about this recent addition of handling\n$XDG_CONFIG_HOME/git/config -- is it --global or not? ;)\n\nAccording to the man git-config (v 2.15.0 in debian)\n\n       --global\n           For writing options: write to global ~/.gitconfig file rather than\n           the repository .git/config, write to $XDG_CONFIG_HOME/git/config\n           file if this file exists and the ~/.gitconfig file doesn’t.\n\n           For reading options: read only from global ~/.gitconfig and from\n           $XDG_CONFIG_HOME/git/config rather than from all available files.\n\n           See also the section called “FILES”.\n\nsuggesting that $XDG_CONFIG_HOME/git/config is a part of the \"--global\" config\nspace, which it is not, which is also later described in FILES:\n\n       $(prefix)/etc/gitconfig\n           System-wide configuration file.\n\n       $XDG_CONFIG_HOME/git/config\n           Second user-specific configuration file. If $XDG_CONFIG_HOME is not set or empty, $HOME/.config/git/config will be used. Any\n           single-valued variable set in this file will be overwritten by whatever is in ~/.gitconfig. It is a good idea not to create this file if\n           you sometimes use older versions of Git, as support for this file was added fairly recently.\n\n       ~/.gitconfig\n           User-specific configuration file. Also called \"global\" configuration file.\n\nwhich\n\n1. says that $XDG_CONFIG_HOME/git/config is the \"Second user-specific ...\"\n   suggesting that it should be the one read AFTER the first user-specific...\n   I guess that the first one is the ~/.gitconfig , but then why the first one\n   overrides the settings of the second one ? ;)  (as described above in TFM and\n   see below for an example)\n\n2. why $XDG_CONFIG_HOME/git/config is not a part of the \"global\" configuration?\n\n   I always assumed that \"global\" is ALL settings defined for a user,\n   which are not specific to a repository.\n\n   It is double-confusing since, as --global doc describes (and example\n   below shows), git config --global --add modifies the\n   $XDG_CONFIG_HOME/git/config if there is no ~/.gitconfig\n\n   Actually the doc for --global for \"reading\" seems to be not correct,\n   that the file is not consulted for --global (see below)\n\nExample to show that TFM outlines precedence and --global correctly:\n\n$> grep xdg .gitconfig .config/git/config                              \n.gitconfig:    xdg-and-user = user\n.config/git/config: xdg = xdg\n.config/git/config: xdg-and-user = xdg\n$> git config user.xdg ; git config user.xdg-and-user\nxdg                          \nuser\n$> git config --global user.xdg            # so outputs nothing\n$> git config --global user.xdg-and-user\nuser\n\n$> mv .gitconfig{,.aside}\n$> git config --global --add user.new value \n$> cat .config/git/config \n[user]\n xdg = xdg\n xdg-and-user = xdg\n new = value\n\n\nSo, is that simply a bug and $XDG_CONFIG_HOME/git/config should be\nconsulted for --global reading and doc should be adjusted to\nstate that it is a part of \"global\" config in FILES description?\nOr it shouldn't be --global (then writing should be fixed, and\ndocumentation adjusted to exclude it from --global)\nOr am I just confused? ;)\n\nthanks in advance for the clarification!\n\n[1]  https://github.com/datalad/datalad/pull/2019#issuecomment-350757960\n-- \nYaroslav O. Halchenko\nCenter for Open Neuroscience     http://centerforopenneuroscience.org\nDartmouth College, 419 Moore Hall, Hinman Box 6207, Hanover, NH 03755\nPhone: +1 (603) 646-9834                       Fax: +1 (603) 646-1419\nWWW:   http://www.linkedin.com/in/yarik        \n"},{"id":"334636","messageId":"20171211225615.GC214273@aiede.mtv.corp.google.com","threadId":"47428","inReplyTo":"20171211211102.rrxqd6yscnd33efd@hopa.kiewit.dartmouth.edu","subject":"Re: Q: rational for $XDG_CONFIG_HOME/git/config to be \"non global\" or just a bug?","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2017-12-11T22:56:15Z","receivedAt":"2017-12-11T22:56:28Z","isPatch":false,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Hi,\n\nYaroslav Halchenko wrote:\n\n> Example to show that TFM outlines precedence and --global correctly:\n>\n> $> grep xdg .gitconfig .config/git/config\n> .gitconfig:    xdg-and-user = user\n> .config/git/config: xdg = xdg\n> .config/git/config: xdg-and-user = xdg\n> $> git config user.xdg ; git config user.xdg-and-user\n> xdg\n> user\n\nI agree, this is confusing.\n\nReverse engineering from source, I find that git reads the following\nfiles in sequence:\n\n\tsystem:\n\t\t/etc/gitconfig\n\tglobal:\n\t\t$XDG_CONFIG_HOME/git/config\n\t\t$HOME/.gitconfig\n\trepo:\n\t\t$GIT_DIR/config\n\tcommandline:\n\t\toptions passed with -c or GIT_CONFIG_PARAMETERS\n\nThese terms (system, global, repo, etc) are accessible in code as\ncurrent_config_scope().  I don't think there's any user-visible effect\nto $XDG_CONFIG_HOME/git/config and $HOME/.gitconfig both being global\n--- it would probably be a good cleanup to rename the scope for one of\nthem.\n\nI think the documentation\n\n\t~/.gitconfig\n\t\tUser-specific configuration file. Also called \"global\"\n\t\tconfiguration file.\n\nshould be clarified --- e.g. it could say\n\n\t$XDG_CONFIG_HOME/git/config\n\t~/.gitconfig\n\t\tUser-specific configuration files. Because options in\n\t\tthese files are not specific to any repository, thes\n\t\tare sometimes called global configuration files.\n\nAs for \"git config --global\", I think the best thing would be to split\nit into two options: something like \"git config --user\" and \"git\nconfig --xdg-user\".  That way, it is unambiguous which configuration\nfile the user intends to inspect or modify.  When a user calls \"git\nconfig --global\" and both files exist, it could warn that the command\nis ambiguous.\n\nThoughts?\n\nThanks,\nJonathan\n"},{"id":"334657","messageId":"20171212004831.2sfscbrlhyokzchz@hopa.kiewit.dartmouth.edu","threadId":"47428","inReplyTo":"20171211225615.GC214273@aiede.mtv.corp.google.com","subject":"Re: Q: rational for $XDG_CONFIG_HOME/git/config to be \"non global\" or just a bug?","fromName":"Yaroslav Halchenko","fromEmail":"yoh@onerussian.com","sentAt":"2017-12-12T00:48:31Z","receivedAt":"2017-12-12T00:48:45Z","isPatch":false,"sender":{"key":"yoh@onerussian.com","avatar":"https://gravatar.com/avatar/8901b82415ae451a83aea49409708912726e53620e3ac92320bf1f86548d97e9?d=mp&s=160"},"body":"\nOn Mon, 11 Dec 2017, Jonathan Nieder wrote:\n> > Example to show that TFM outlines precedence and --global correctly:\n\n> > $> grep xdg .gitconfig .config/git/config\n> > .gitconfig:    xdg-and-user = user\n> > .config/git/config: xdg = xdg\n> > .config/git/config: xdg-and-user = xdg\n> > $> git config user.xdg ; git config user.xdg-and-user\n> > xdg\n> > user\n\n> I agree, this is confusing.\n\n> Reverse engineering from source, I find that git reads the following\n> files in sequence:\n\n> \tsystem:\n> \t\t/etc/gitconfig\n> \tglobal:\n> \t\t$XDG_CONFIG_HOME/git/config\n> \t\t$HOME/.gitconfig\n> \trepo:\n> \t\t$GIT_DIR/config\n> \tcommandline:\n> \t\toptions passed with -c or GIT_CONFIG_PARAMETERS\n\n> These terms (system, global, repo, etc) are accessible in code as\n> current_config_scope().  I don't think there's any user-visible effect\n> to $XDG_CONFIG_HOME/git/config and $HOME/.gitconfig both being global\n> --- it would probably be a good cleanup to rename the scope for one of\n> them.\n\nWell, we have got at least one user/contributor now who uses\n$XDG_CONFIG_HOME/git/config in favor of ~/.gitconfig since it makes it\neasier for modular user configuration.\n\n> I think the documentation\n\n> \t~/.gitconfig\n> \t\tUser-specific configuration file. Also called \"global\"\n> \t\tconfiguration file.\n\n> should be clarified --- e.g. it could say\n\n> \t$XDG_CONFIG_HOME/git/config\n> \t~/.gitconfig\n> \t\tUser-specific configuration files. Because options in\n> \t\tthese files are not specific to any repository, thes\n> \t\tare sometimes called global configuration files.\n\n> As for \"git config --global\", I think the best thing would be to split\n> it into two options: something like \"git config --user\" and \"git\n> config --xdg-user\".  That way, it is unambiguous which configuration\n> file the user intends to inspect or modify.  When a user calls \"git\n> config --global\" and both files exist, it could warn that the command\n> is ambiguous.\n\nwhy ambiguous?  as long as both are consistently called global, and the\noverloading rules are clear for reading -- nothing ambigous.  The only\nambigous logic would be for writing.\n\n> Thoughts?\n\nWell -- my main functionality concern that ATM\n$XDG_CONFIG_HOME/git/config is (as of 2.15.0) only --global for writing\nbut not for regular reading (as I demonstrated in the original email)\n\n-- \nYaroslav O. Halchenko\nCenter for Open Neuroscience     http://centerforopenneuroscience.org\nDartmouth College, 419 Moore Hall, Hinman Box 6207, Hanover, NH 03755\nPhone: +1 (603) 646-9834                       Fax: +1 (603) 646-1419\nWWW:   http://www.linkedin.com/in/yarik        \n"},{"id":"334660","messageId":"xmqqtvww3gea.fsf@gitster.mtv.corp.google.com","threadId":"47428","inReplyTo":"20171211225615.GC214273@aiede.mtv.corp.google.com","subject":"Re: Q: rational for $XDG_CONFIG_HOME/git/config to be \"non global\" or just a bug?","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2017-12-12T01:05:01Z","receivedAt":"2017-12-12T01:05:14Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jonathan Nieder <jrnieder@gmail.com> writes:\n\n> I think the documentation\n>\n> \t~/.gitconfig\n> \t\tUser-specific configuration file. Also called \"global\"\n> \t\tconfiguration file.\n>\n> should be clarified --- e.g. it could say\n>\n> \t$XDG_CONFIG_HOME/git/config\n> \t~/.gitconfig\n> \t\tUser-specific configuration files. Because options in\n> \t\tthese files are not specific to any repository, thes\n> \t\tare sometimes called global configuration files.\n\nYeah, I think that makes sense.\n\n> As for \"git config --global\", I think the best thing would be to split\n> it into two options: something like \"git config --user\" and \"git\n> config --xdg-user\".  That way, it is unambiguous which configuration\n> file the user intends to inspect or modify.  When a user calls \"git\n> config --global\" and both files exist, it could warn that the command\n> is ambiguous.\n>\n> Thoughts?\n\nI actually thought that the plan was \"you either have this, or the\nother one, never both at the same time\" (and I think those who\npushed the XDG thing in to the system made us favor it over the\ntraditional one).  So as long as --global updates the one that\nexists, and updates XDG one when both or neither do, I think we\nshould be OK.  And from that viewpoint, we definitely do not want\ntwo kinds of --global to pretend as if we support use of both at the\nsame time.\n\n"},{"id":"334667","messageId":"CA+P7+xpH6M-FqRJcvsbv=mjj1T04GR6pxz-4NkTmGZUgUKU6wQ@mail.gmail.com","threadId":"47428","inReplyTo":"xmqqtvww3gea.fsf@gitster.mtv.corp.google.com","subject":"Re: Q: rational for $XDG_CONFIG_HOME/git/config to be \"non global\" or just a bug?","fromName":"Jacob Keller","fromEmail":"jacob.keller@gmail.com","sentAt":"2017-12-12T09:36:17Z","receivedAt":"2017-12-12T09:36:47Z","isPatch":false,"sender":{"key":"jacob.keller@gmail.com","avatar":"https://avatars.githubusercontent.com/u/874719?v=4"},"body":"On Mon, Dec 11, 2017 at 5:05 PM, Junio C Hamano <gitster@pobox.com> wrote:\n> Jonathan Nieder <jrnieder@gmail.com> writes:\n>\n>> I think the documentation\n>>\n>>       ~/.gitconfig\n>>               User-specific configuration file. Also called \"global\"\n>>               configuration file.\n>>\n>> should be clarified --- e.g. it could say\n>>\n>>       $XDG_CONFIG_HOME/git/config\n>>       ~/.gitconfig\n>>               User-specific configuration files. Because options in\n>>               these files are not specific to any repository, thes\n>>               are sometimes called global configuration files.\n>\n> Yeah, I think that makes sense.\n>\n>> As for \"git config --global\", I think the best thing would be to split\n>> it into two options: something like \"git config --user\" and \"git\n>> config --xdg-user\".  That way, it is unambiguous which configuration\n>> file the user intends to inspect or modify.  When a user calls \"git\n>> config --global\" and both files exist, it could warn that the command\n>> is ambiguous.\n>>\n>> Thoughts?\n>\n> I actually thought that the plan was \"you either have this, or the\n> other one, never both at the same time\" (and I think those who\n> pushed the XDG thing in to the system made us favor it over the\n> traditional one).  So as long as --global updates the one that\n> exists, and updates XDG one when both or neither do, I think we\n> should be OK.  And from that viewpoint, we definitely do not want\n> two kinds of --global to pretend as if we support use of both at the\n> same time.\n>\n\nIt appears that we actually prefer ~/.gitconfig rather than XDG_CONFIG_HOME..\n\nAnd at least based on current cursory testing on the command line, we\ndo both read and write to the proper location, assuming that\n~/.gitconfig is preferred over $XDG_CONFIG_HOME.\n\nThanks,\nJake\n"},{"id":"334679","messageId":"20171212141355.7hcuegaopb6hee2l@hopa.kiewit.dartmouth.edu","threadId":"47428","inReplyTo":"xmqqtvww3gea.fsf@gitster.mtv.corp.google.com","subject":"Re: Q: rational for $XDG_CONFIG_HOME/git/config to be \"non global\" or just a bug?","fromName":"Yaroslav Halchenko","fromEmail":"yoh@onerussian.com","sentAt":"2017-12-12T14:13:55Z","receivedAt":"2017-12-12T14:14:09Z","isPatch":false,"sender":{"key":"yoh@onerussian.com","avatar":"https://gravatar.com/avatar/8901b82415ae451a83aea49409708912726e53620e3ac92320bf1f86548d97e9?d=mp&s=160"},"body":"\nOn Mon, 11 Dec 2017, Junio C Hamano wrote:\n\n> Jonathan Nieder <jrnieder@gmail.com> writes:\n\n> > I think the documentation\n\n> > \t~/.gitconfig\n> > \t\tUser-specific configuration file. Also called \"global\"\n> > \t\tconfiguration file.\n\n> > should be clarified --- e.g. it could say\n\n> > \t$XDG_CONFIG_HOME/git/config\n> > \t~/.gitconfig\n> > \t\tUser-specific configuration files. Because options in\n> > \t\tthese files are not specific to any repository, thes\n> > \t\tare sometimes called global configuration files.\n\n> Yeah, I think that makes sense.\n\n> > As for \"git config --global\", I think the best thing would be to split\n> > it into two options: something like \"git config --user\" and \"git\n> > config --xdg-user\".  That way, it is unambiguous which configuration\n> > file the user intends to inspect or modify.  When a user calls \"git\n> > config --global\" and both files exist, it could warn that the command\n> > is ambiguous.\n\n> > Thoughts?\n\n> I actually thought that the plan was \"you either have this, or the\n> other one, never both at the same time\" (and I think those who\n> pushed the XDG thing in to the system made us favor it over the\n> traditional one).  So as long as --global updates the one that\n> exists, and updates XDG one when both or neither do, I think we\n> should be OK.  And from that viewpoint, we definitely do not want\n> two kinds of --global to pretend as if we support use of both at the\n> same time.\n\nnote that atm $XDG_CONFIG_HOME/git/config is read as --global iff\n~/.gitconfig is absent and read always without --global.  So it is\nflipping between \"global\" and \"some kind of non-global but user-specific\nconfiguration file\" (so sounds like  a global to me ;) )\n\n-- \nYaroslav O. Halchenko\nCenter for Open Neuroscience     http://centerforopenneuroscience.org\nDartmouth College, 419 Moore Hall, Hinman Box 6207, Hanover, NH 03755\nPhone: +1 (603) 646-9834                       Fax: +1 (603) 646-1419\nWWW:   http://www.linkedin.com/in/yarik        \n"},{"id":"334696","messageId":"xmqqshcf20y1.fsf@gitster.mtv.corp.google.com","threadId":"47428","inReplyTo":"CA+P7+xpH6M-FqRJcvsbv=mjj1T04GR6pxz-4NkTmGZUgUKU6wQ@mail.gmail.com","subject":"Re: Q: rational for $XDG_CONFIG_HOME/git/config to be \"non global\" or just a bug?","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2017-12-12T19:36:22Z","receivedAt":"2017-12-12T19:36:33Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jacob Keller <jacob.keller@gmail.com> writes:\n\n>> I actually thought that the plan was \"you either have this, or the\n>> other one, never both at the same time\" (and I think those who\n>> pushed the XDG thing in to the system made us favor it over the\n>> traditional one).  So as long as --global updates the one that\n>> exists, and updates XDG one when both or neither do, I think we\n>> should be OK.  And from that viewpoint, we definitely do not want\n>> two kinds of --global to pretend as if we support use of both at the\n>> same time.\n>\n> It appears that we actually prefer ~/.gitconfig rather than XDG_CONFIG_HOME..\n>\n> And at least based on current cursory testing on the command line, we\n> do both read and write to the proper location, assuming that\n> ~/.gitconfig is preferred over $XDG_CONFIG_HOME.\n\nOK, so I misremembered the details but it seems that the behaviour\nis consistent and there is no ambiguity?  \n\nAm I reading you correctly?\n"},{"id":"334735","messageId":"CA+P7+xqsKDqZK=7vaLqFeuqXjSrTgqupWnNA4WrxN8J9Td7N7A@mail.gmail.com","threadId":"47428","inReplyTo":"20171212141355.7hcuegaopb6hee2l@hopa.kiewit.dartmouth.edu","subject":"Re: Q: rational for $XDG_CONFIG_HOME/git/config to be \"non global\" or just a bug?","fromName":"Jacob Keller","fromEmail":"jacob.keller@gmail.com","sentAt":"2017-12-13T05:35:08Z","receivedAt":"2017-12-13T05:35:38Z","isPatch":false,"sender":{"key":"jacob.keller@gmail.com","avatar":"https://avatars.githubusercontent.com/u/874719?v=4"},"body":"On Tue, Dec 12, 2017 at 6:13 AM, Yaroslav Halchenko <yoh@onerussian.com> wrote:\n>\n> On Mon, 11 Dec 2017, Junio C Hamano wrote:\n>\n>> Jonathan Nieder <jrnieder@gmail.com> writes:\n>\n>> > I think the documentation\n>\n>> >     ~/.gitconfig\n>> >             User-specific configuration file. Also called \"global\"\n>> >             configuration file.\n>\n>> > should be clarified --- e.g. it could say\n>\n>> >     $XDG_CONFIG_HOME/git/config\n>> >     ~/.gitconfig\n>> >             User-specific configuration files. Because options in\n>> >             these files are not specific to any repository, thes\n>> >             are sometimes called global configuration files.\n>\n>> Yeah, I think that makes sense.\n>\n>> > As for \"git config --global\", I think the best thing would be to split\n>> > it into two options: something like \"git config --user\" and \"git\n>> > config --xdg-user\".  That way, it is unambiguous which configuration\n>> > file the user intends to inspect or modify.  When a user calls \"git\n>> > config --global\" and both files exist, it could warn that the command\n>> > is ambiguous.\n>\n>> > Thoughts?\n>\n>> I actually thought that the plan was \"you either have this, or the\n>> other one, never both at the same time\" (and I think those who\n>> pushed the XDG thing in to the system made us favor it over the\n>> traditional one).  So as long as --global updates the one that\n>> exists, and updates XDG one when both or neither do, I think we\n>> should be OK.  And from that viewpoint, we definitely do not want\n>> two kinds of --global to pretend as if we support use of both at the\n>> same time.\n>\n> note that atm $XDG_CONFIG_HOME/git/config is read as --global iff\n> ~/.gitconfig is absent and read always without --global.  So it is\n> flipping between \"global\" and \"some kind of non-global but user-specific\n> configuration file\" (so sounds like  a global to me ;) )\n>\n> --\n> Yaroslav O. Halchenko\n> Center for Open Neuroscience     http://centerforopenneuroscience.org\n> Dartmouth College, 419 Moore Hall, Hinman Box 6207, Hanover, NH 03755\n> Phone: +1 (603) 646-9834                       Fax: +1 (603) 646-1419\n> WWW:   http://www.linkedin.com/in/yarik\n\nI didn't see it read, if ~/.gitconfig exists, it appears to never be\nread on my system..\n\nThanks,\nJake\n"},{"id":"334736","messageId":"CA+P7+xo4G=qou=VGYCu0TgwUT5g_dnNTPB31WyRdC29w3p_CpA@mail.gmail.com","threadId":"47428","inReplyTo":"xmqqshcf20y1.fsf@gitster.mtv.corp.google.com","subject":"Re: Q: rational for $XDG_CONFIG_HOME/git/config to be \"non global\" or just a bug?","fromName":"Jacob Keller","fromEmail":"jacob.keller@gmail.com","sentAt":"2017-12-13T05:35:30Z","receivedAt":"2017-12-13T05:35:56Z","isPatch":false,"sender":{"key":"jacob.keller@gmail.com","avatar":"https://avatars.githubusercontent.com/u/874719?v=4"},"body":"On Tue, Dec 12, 2017 at 11:36 AM, Junio C Hamano <gitster@pobox.com> wrote:\n> Jacob Keller <jacob.keller@gmail.com> writes:\n>\n>>> I actually thought that the plan was \"you either have this, or the\n>>> other one, never both at the same time\" (and I think those who\n>>> pushed the XDG thing in to the system made us favor it over the\n>>> traditional one).  So as long as --global updates the one that\n>>> exists, and updates XDG one when both or neither do, I think we\n>>> should be OK.  And from that viewpoint, we definitely do not want\n>>> two kinds of --global to pretend as if we support use of both at the\n>>> same time.\n>>\n>> It appears that we actually prefer ~/.gitconfig rather than XDG_CONFIG_HOME..\n>>\n>> And at least based on current cursory testing on the command line, we\n>> do both read and write to the proper location, assuming that\n>> ~/.gitconfig is preferred over $XDG_CONFIG_HOME.\n>\n> OK, so I misremembered the details but it seems that the behaviour\n> is consistent and there is no ambiguity?\n>\n> Am I reading you correctly?\n\nAs far as I could tell based on local testing. I could be wrong, and\nhaven't yet cooked up a test case for it yet.\n\nThanks,\nJake\n"},{"id":"334943","messageId":"20171216220120.GB6217@genre.crustytoothpaste.net","threadId":"47428","inReplyTo":"xmqqtvww3gea.fsf@gitster.mtv.corp.google.com","subject":"Re: Q: rational for $XDG_CONFIG_HOME/git/config to be \"non global\" or just a bug?","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2017-12-16T22:01:20Z","receivedAt":"2017-12-16T22:02:23Z","isPatch":false,"sender":{"key":"sandals@crustytoothpaste.net","avatar":"https://avatars.githubusercontent.com/u/497054?v=4"},"body":"On Mon, Dec 11, 2017 at 05:05:01PM -0800, Junio C Hamano wrote:\n> Jonathan Nieder <jrnieder@gmail.com> writes:\n> > As for \"git config --global\", I think the best thing would be to split\n> > it into two options: something like \"git config --user\" and \"git\n> > config --xdg-user\".  That way, it is unambiguous which configuration\n> > file the user intends to inspect or modify.  When a user calls \"git\n> > config --global\" and both files exist, it could warn that the command\n> > is ambiguous.\n> >\n> > Thoughts?\n> \n> I actually thought that the plan was \"you either have this, or the\n> other one, never both at the same time\" (and I think those who\n> pushed the XDG thing in to the system made us favor it over the\n> traditional one).  So as long as --global updates the one that\n> exists, and updates XDG one when both or neither do, I think we\n> should be OK.  And from that viewpoint, we definitely do not want\n> two kinds of --global to pretend as if we support use of both at the\n> same time.\n\nSorry for coming late to the discussion, but I actually use both.\n\n~/.gitconfig is checked into my Git repo for my home directory and\ncontains settings I preserve across all systems, and the XDG dir is not\nchecked in and contains per-system settings (currently just\ncommit.gpgsign).  On my main systems I have a key and sign commits; if\nit's just some server I log into, I don't.\n\nNow, I don't use git config to set options, so I'm happy as long as git\nconfig can read both, which it does.\n-- \nbrian m. carlson / brian with sandals: Houston, Texas, US\nhttps://www.crustytoothpaste.net/~bmc | My opinion only\nOpenPGP: https://keybase.io/bk2204\n"},{"id":"334958","messageId":"CA+P7+xpFyD0zuOz7XSCc6cV1T1zu6j-gZD=EMQs-t2WPxi1EMA@mail.gmail.com","threadId":"47428","inReplyTo":"20171216220120.GB6217@genre.crustytoothpaste.net","subject":"Re: Q: rational for $XDG_CONFIG_HOME/git/config to be \"non global\" or just a bug?","fromName":"Jacob Keller","fromEmail":"jacob.keller@gmail.com","sentAt":"2017-12-18T04:03:41Z","receivedAt":"2017-12-18T04:04:08Z","isPatch":false,"sender":{"key":"jacob.keller@gmail.com","avatar":"https://avatars.githubusercontent.com/u/874719?v=4"},"body":"On Sat, Dec 16, 2017 at 2:01 PM, brian m. carlson\n<sandals@crustytoothpaste.net> wrote:\n> On Mon, Dec 11, 2017 at 05:05:01PM -0800, Junio C Hamano wrote:\n>> Jonathan Nieder <jrnieder@gmail.com> writes:\n>> > As for \"git config --global\", I think the best thing would be to split\n>> > it into two options: something like \"git config --user\" and \"git\n>> > config --xdg-user\".  That way, it is unambiguous which configuration\n>> > file the user intends to inspect or modify.  When a user calls \"git\n>> > config --global\" and both files exist, it could warn that the command\n>> > is ambiguous.\n>> >\n>> > Thoughts?\n>>\n>> I actually thought that the plan was \"you either have this, or the\n>> other one, never both at the same time\" (and I think those who\n>> pushed the XDG thing in to the system made us favor it over the\n>> traditional one).  So as long as --global updates the one that\n>> exists, and updates XDG one when both or neither do, I think we\n>> should be OK.  And from that viewpoint, we definitely do not want\n>> two kinds of --global to pretend as if we support use of both at the\n>> same time.\n>\n> Sorry for coming late to the discussion, but I actually use both.\n>\n> ~/.gitconfig is checked into my Git repo for my home directory and\n> contains settings I preserve across all systems, and the XDG dir is not\n> checked in and contains per-system settings (currently just\n> commit.gpgsign).  On my main systems I have a key and sign commits; if\n> it's just some server I log into, I don't.\n>\n> Now, I don't use git config to set options, so I'm happy as long as git\n> config can read both, which it does.\n> --\n> brian m. carlson / brian with sandals: Houston, Texas, US\n> https://www.crustytoothpaste.net/~bmc | My opinion only\n> OpenPGP: https://keybase.io/bk2204\n\n\nOk, so my patch documentation is wrong. Perhaps we could further\nclarify in the documentation how it works, but I'm not really sure\nwhat the best approach is.\n\nI do find it a bit weird that --global writes to one of either file,\nand doesn't read from both. I'd rather have --global \"only\" be\n.gitconfig, and instead add a new option for handling XDG file, and\nthen have it such that it reads them in system -> xdg ->\nhome/.gitconfig -> local, which allows for local .gitconfig to\noverride XDG config, but logically treat them just like we do any\nother files.\n\nThanks,\nJake\n"},{"id":"334959","messageId":"20171218064042.GA25733@sigill.intra.peff.net","threadId":"47428","inReplyTo":"CA+P7+xpFyD0zuOz7XSCc6cV1T1zu6j-gZD=EMQs-t2WPxi1EMA@mail.gmail.com","subject":"Re: Q: rational for $XDG_CONFIG_HOME/git/config to be \"non global\" or just a bug?","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2017-12-18T06:40:42Z","receivedAt":"2017-12-18T06:40:50Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Sun, Dec 17, 2017 at 08:03:41PM -0800, Jacob Keller wrote:\n\n> I do find it a bit weird that --global writes to one of either file,\n> and doesn't read from both. I'd rather have --global \"only\" be\n> .gitconfig, and instead add a new option for handling XDG file, and\n> then have it such that it reads them in system -> xdg ->\n> home/.gitconfig -> local, which allows for local .gitconfig to\n> override XDG config, but logically treat them just like we do any\n> other files.\n\nI find it weird, too, but I'm not sure that's the right direction. It\nmeans that users have to start caring about using \"--xdg\" instead of\n\"--global\" if that's what they want to write to. The original idea was\nthat the transition to xdg should be fairly seamless, and that --global\nwould be an abstraction over both.\n\nTo complete that abstraction it seems like reading via \"--global\" should\nread from both (in the same precedence order that normal config lookup\nuses). If you only use one, there wouldn't be any change in behavior.\nAnd if you use both, then the behavior makes sense as a subset of the\nnormal config lookup. I.e., it could even be explained as:\n\n  If you give no \"source\", normal config lookup is similar to checking\n  \"--system\", then \"--global\", then \"--local\".\n\nThe only person who might be affected is somebody who carries both files\n_and_ really wanted \"--global\" to read from one specific file (though I\nhave no idea from which without looking at the source, and from reading\nthis thread it seems I am not the only one who would be confused). So\nI'd be OK calling that an unintended and unsupported behavior, and the\nright thing all along should have been to use \"--file=\" if you really\nwant to avoid \"--global\" automagic.\n\n-Peff\n"},{"id":"334966","messageId":"20171218142100.3mhshemnooc3sykv@hopa.kiewit.dartmouth.edu","threadId":"47428","inReplyTo":"20171218064042.GA25733@sigill.intra.peff.net","subject":"Re: Q: rational for $XDG_CONFIG_HOME/git/config to be \"non global\" or just a bug?","fromName":"Yaroslav Halchenko","fromEmail":"yoh@onerussian.com","sentAt":"2017-12-18T14:21:00Z","receivedAt":"2017-12-18T14:21:19Z","isPatch":false,"sender":{"key":"yoh@onerussian.com","avatar":"https://gravatar.com/avatar/8901b82415ae451a83aea49409708912726e53620e3ac92320bf1f86548d97e9?d=mp&s=160"},"body":"\nOn Mon, 18 Dec 2017, Jeff King wrote:\n\n> To complete that abstraction it seems like reading via \"--global\" should\n> read from both (in the same precedence order that normal config lookup\n> uses).\n\nFWIW +1 from me on that ;)\n\n-- \nYaroslav O. Halchenko\nCenter for Open Neuroscience     http://centerforopenneuroscience.org\nDartmouth College, 419 Moore Hall, Hinman Box 6207, Hanover, NH 03755\nPhone: +1 (603) 646-9834                       Fax: +1 (603) 646-1419\nWWW:   http://www.linkedin.com/in/yarik        \n"},{"id":"334971","messageId":"xmqqvah4nfg8.fsf@gitster.mtv.corp.google.com","threadId":"47428","inReplyTo":"20171218142100.3mhshemnooc3sykv@hopa.kiewit.dartmouth.edu","subject":"Re: Q: rational for $XDG_CONFIG_HOME/git/config to be \"non global\" or just a bug?","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2017-12-18T16:55:35Z","receivedAt":"2017-12-18T16:55:47Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Yaroslav Halchenko <yoh@onerussian.com> writes:\n\n> On Mon, 18 Dec 2017, Jeff King wrote:\n>\n>> To complete that abstraction it seems like reading via \"--global\" should\n>> read from both (in the same precedence order that normal config lookup\n>> uses).\n>\n> FWIW +1 from me on that ;)\n\nFWIW I do not have problem with that endgame.\n\nI wonder if anybody wants to get their hands dirty.  It should be a\nquite straight-forward to split a helper (or three) out of the\ndo_git_config_sequence() helper, but the interface from cmd_config()\nto call into config.c to read a specific \"class\" of config file is\nthe same codepath as a single file, so a major part of this work\nwill be to design how to extend the interface to do the limited\n\"sequence\" thing.\n"},{"id":"334989","messageId":"CA+P7+xoH=wxYntERNiC4g32Kd9VmHmrBTCka-GCw+v6OsyjZ3w@mail.gmail.com","threadId":"47428","inReplyTo":"20171218064042.GA25733@sigill.intra.peff.net","subject":"Re: Q: rational for $XDG_CONFIG_HOME/git/config to be \"non global\" or just a bug?","fromName":"Jacob Keller","fromEmail":"jacob.keller@gmail.com","sentAt":"2017-12-18T19:56:45Z","receivedAt":"2017-12-18T19:57:12Z","isPatch":false,"sender":{"key":"jacob.keller@gmail.com","avatar":"https://avatars.githubusercontent.com/u/874719?v=4"},"body":"On Sun, Dec 17, 2017 at 10:40 PM, Jeff King <peff@peff.net> wrote:\n> On Sun, Dec 17, 2017 at 08:03:41PM -0800, Jacob Keller wrote:\n>\n>> I do find it a bit weird that --global writes to one of either file,\n>> and doesn't read from both. I'd rather have --global \"only\" be\n>> .gitconfig, and instead add a new option for handling XDG file, and\n>> then have it such that it reads them in system -> xdg ->\n>> home/.gitconfig -> local, which allows for local .gitconfig to\n>> override XDG config, but logically treat them just like we do any\n>> other files.\n>\n> I find it weird, too, but I'm not sure that's the right direction. It\n> means that users have to start caring about using \"--xdg\" instead of\n> \"--global\" if that's what they want to write to. The original idea was\n> that the transition to xdg should be fairly seamless, and that --global\n> would be an abstraction over both.\n>\n> To complete that abstraction it seems like reading via \"--global\" should\n> read from both (in the same precedence order that normal config lookup\n> uses). If you only use one, there wouldn't be any change in behavior.\n> And if you use both, then the behavior makes sense as a subset of the\n> normal config lookup. I.e., it could even be explained as:\n>\n>   If you give no \"source\", normal config lookup is similar to checking\n>   \"--system\", then \"--global\", then \"--local\".\n>\n> The only person who might be affected is somebody who carries both files\n> _and_ really wanted \"--global\" to read from one specific file (though I\n> have no idea from which without looking at the source, and from reading\n> this thread it seems I am not the only one who would be confused). So\n> I'd be OK calling that an unintended and unsupported behavior, and the\n> right thing all along should have been to use \"--file=\" if you really\n> want to avoid \"--global\" automagic.\n>\n> -Peff\n\nI think this end game is fine with me too, it's definitely better than\nwhat we have now.\n\nThanks,\nJake\n"}]}