{"thread":{"id":"53711","subject":"git config not following include paths by default","startedAt":"2020-06-18T20:25:49Z","lastAt":"2020-06-19T18:50:45Z","messageCount":4,"participants":["Paul S. Strauss","Jeff King"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"400077","messageId":"6aab7843-7ece-5499-c074-a5fa8ef68beb@acm.org","threadId":"53711","inReplyTo":null,"subject":"git config not following include paths by default","fromName":"Paul S. Strauss","fromEmail":"pss@acm.org","sentAt":"2020-06-18T20:25:45Z","receivedAt":"2020-06-18T20:25:49Z","isPatch":false,"sender":{"key":"pss@acm.org","avatar":null},"body":"Using git version 2.25.1 in a bash shell on Ubuntu 20.04 (focal).\n\nMy global git config file has an [include] with path set to additional \nconfiguration.\n\n\"git config --list --show-origin --includes\" shows all of my configuration, \nincluding items from the included file.\n\n\"git config --list --show-origin\" shows only the items in my main config file. \nNot sure why \"--no-includes\" is the default, but not a huge deal either way.\n\nWhat is a big deal is that none of the configuration in my included config file \nis available to me. I have lots of aliases and other settings in the included \nfile, but none of them work.\n\nThis can't be the expected behavior, can it? If so, then including config files \nis pretty useless.\n\n-- \nPaul S. Strausspss@acm.org\n\n"},{"id":"400085","messageId":"b9f47155-e6ef-5868-898d-f5a703e2fd94@acm.org","threadId":"53711","inReplyTo":"6aab7843-7ece-5499-c074-a5fa8ef68beb@acm.org","subject":"Re: git config not following include paths by default","fromName":"Paul S. Strauss","fromEmail":"pss@acm.org","sentAt":"2020-06-18T20:40:11Z","receivedAt":"2020-06-18T20:41:13Z","isPatch":false,"sender":{"key":"pss@acm.org","avatar":null},"body":"Update:\n\nThe problem is related to my having GIT_CONFIG set to a file other than \n~/.gitconfig - when I unset GIT_CONFIG and copied my config file to \n~/.gitconfig, the include worked as expected.\n\nSo, to reproduce:\n\n    Do NOT have a ~/.gitconfig file\n    Set GIT_CONFIG to a configuration file with [include] statements\n    Then the behavior I mentioned will occur\n\n\n\nOn 6/18/20 1:25 PM, Paul S. Strauss wrote:\n> Using git version 2.25.1 in a bash shell on Ubuntu 20.04 (focal).\n>\n> My global git config file has an [include] with path set to additional \n> configuration.\n>\n> \"git config --list --show-origin --includes\" shows all of my configuration, \n> including items from the included file.\n>\n> \"git config --list --show-origin\" shows only the items in my main config file. \n> Not sure why \"--no-includes\" is the default, but not a huge deal either way.\n>\n> What is a big deal is that none of the configuration in my included config \n> file is available to me. I have lots of aliases and other settings in the \n> included file, but none of them work.\n>\n> This can't be the expected behavior, can it? If so, then including config \n> files is pretty useless.\n>\n\n-- \nPaul S. Strauss                                  pss@acm.org\n\n"},{"id":"400108","messageId":"20200619115859.GA1835585@coredump.intra.peff.net","threadId":"53711","inReplyTo":"b9f47155-e6ef-5868-898d-f5a703e2fd94@acm.org","subject":"Re: git config not following include paths by default","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2020-06-19T11:58:59Z","receivedAt":"2020-06-19T11:59:05Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Thu, Jun 18, 2020 at 01:40:11PM -0700, Paul S. Strauss wrote:\n\n> The problem is related to my having GIT_CONFIG set to a file other than\n> ~/.gitconfig - when I unset GIT_CONFIG and copied my config file to\n> ~/.gitconfig, the include worked as expected.\n\nThat's working as designed. From git-config(1):\n\n   --[no-]includes\n       Respect include.* directives in config files when looking up\n       values. Defaults to off when a specific file is given (e.g.,\n       using --file, --global, etc) and on when searching all config\n       files.\n\nThe reasons for that are historical. Includes were added much later, and\nyou would probably not want \"git config --file=.gitmodules\" against an\nuntrusted input to be able to include from anywhere on your filesystem.\n\n$GIT_CONFIG works the same way (as it's equivalent to using --file).  We\ngenerally discourage the use of the environment variable (and its\nexistence is yet another historical compatibility thing). If you tell us\nmore about what you're trying to accomplish with it, we might be able to\nsuggest a better solution.\n\n-Peff\n"},{"id":"400205","messageId":"3b4585dd-1d45-0631-f422-dfe13cc38a10@acm.org","threadId":"53711","inReplyTo":"20200619115859.GA1835585@coredump.intra.peff.net","subject":"Re: git config not following include paths by default","fromName":"Paul S. Strauss","fromEmail":"pss@acm.org","sentAt":"2020-06-19T18:50:40Z","receivedAt":"2020-06-19T18:50:45Z","isPatch":false,"sender":{"key":"pss@acm.org","avatar":null},"body":"Thank you very much for your help.\n\nI was trying to set up a dual-platform git configuration with a common (synced) \nhome directory structure.\n\nI created gitconfig-linux and gitconfig-windows files that both include \ngitconfig-common. (I would have done it the other way around if there was a \nplatform-based includeIf). Then I just set GIT_CONFIG to gitconfig-<platform> on \neach system, which led to the problem.\n\nI worked around it by linking ~/.gitconfig to the the platform-specific file on \neach platform, but that is not ideal, IMO.\n\nI didn't realize that using GIT_CONFIG was deprecated (or that it was equivalent \nto specifying a file); there didn't seem to be a better way to do what I wanted.\n\n    - Paul\n\n\nOn 6/19/20 4:58 AM, Jeff King wrote:\n> On Thu, Jun 18, 2020 at 01:40:11PM -0700, Paul S. Strauss wrote:\n>\n>> The problem is related to my having GIT_CONFIG set to a file other than\n>> ~/.gitconfig - when I unset GIT_CONFIG and copied my config file to\n>> ~/.gitconfig, the include worked as expected.\n> That's working as designed. From git-config(1):\n>\n>     --[no-]includes\n>         Respect include.* directives in config files when looking up\n>         values. Defaults to off when a specific file is given (e.g.,\n>         using --file, --global, etc) and on when searching all config\n>         files.\n>\n> The reasons for that are historical. Includes were added much later, and\n> you would probably not want \"git config --file=.gitmodules\" against an\n> untrusted input to be able to include from anywhere on your filesystem.\n>\n> $GIT_CONFIG works the same way (as it's equivalent to using --file).  We\n> generally discourage the use of the environment variable (and its\n> existence is yet another historical compatibility thing). If you tell us\n> more about what you're trying to accomplish with it, we might be able to\n> suggest a better solution.\n>\n> -Peff\n\n-- \nPaul S. Strauss                                  pss@acm.org\n\n"}]}