{"thread":{"id":"49690","subject":"Possible bug in referenced configuration file loading","startedAt":"2018-10-26T07:31:29Z","lastAt":"2018-10-26T07:58:44Z","messageCount":2,"participants":["Raphael Stolt","Jeff King"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"361604","messageId":"CAM-9DY2KVjq2879TJUNhBsRBbAjScMS7U5scP-fAY0NsvCan9A@mail.gmail.com","threadId":"49690","inReplyTo":null,"subject":"Possible bug in referenced configuration file loading","fromName":"Raphael Stolt","fromEmail":"raphael.stolt@gmail.com","sentAt":"2018-10-26T07:30:51Z","receivedAt":"2018-10-26T07:31:29Z","isPatch":false,"sender":{"key":"raphael.stolt@gmail.com","avatar":"https://gravatar.com/avatar/132faf5713fa951f4263fad02858a62e55c5d832ad775b33e49ba0cda2f2a028?d=mp&s=160"},"body":"Configuration for global ignore patterns in ~/.config/git/config:\n\n[core]\n    excludesfile = .gitignore\n\ndoesn't get looked up per default in ~/.config/git/ which might be\nconsidered a bug as the .gitignore file isn't loaded. It's only loaded\nwhen .gitignore is located in $HOME or explicitly referenced via\n~/.config/git/.gitignore.\n\nConfiguration for a conditional include also in ~/.config/git/config:\n\n[includeIf \"gitdir:~/Work/git-repos/\"]\n    path = .oss-gitconfig\n\ndoes get looked up per default in ~/.config/git/ and  therefor the\n.oss-gitconfig is loaded.\n\nSo there seems to be a difference in Git's configuration loading strategies.\n\nEnvironment details:\n\nmacOS High Sierra\ngit version 2.19.1\n\nWindows 10\ngit version 2.16.1.windows.2\n"},{"id":"361607","messageId":"20181026075841.GB3119@sigill.intra.peff.net","threadId":"49690","inReplyTo":"CAM-9DY2KVjq2879TJUNhBsRBbAjScMS7U5scP-fAY0NsvCan9A@mail.gmail.com","subject":"Re: Possible bug in referenced configuration file loading","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2018-10-26T07:58:41Z","receivedAt":"2018-10-26T07:58:44Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Fri, Oct 26, 2018 at 09:30:51AM +0200, Raphael Stolt wrote:\n\n> Configuration for global ignore patterns in ~/.config/git/config:\n> \n> [core]\n>     excludesfile = .gitignore\n> \n> doesn't get looked up per default in ~/.config/git/ which might be\n> considered a bug as the .gitignore file isn't loaded. It's only loaded\n> when .gitignore is located in $HOME or explicitly referenced via\n> ~/.config/git/.gitignore.\n\nI don't think we ever defined or documented any behavior for relative\npaths in core.excludesFile (nor most other path-based config options).\n\nI suspect it also changes depending on the command, as well as whether\nit is a bare or non-bare repository. Because I think it is probably just\nwherever the cwd happens to be at the time we parse the config, which is\nusually at the top of the working tree (non-bare) or inside the\nrepository (bare).\n\n> Configuration for a conditional include also in ~/.config/git/config:\n> \n> [includeIf \"gitdir:~/Work/git-repos/\"]\n>     path = .oss-gitconfig\n> \n> does get looked up per default in ~/.config/git/ and  therefor the\n> .oss-gitconfig is loaded.\n\nWhereas config includes have always explicitly advertised from day one\nthe behavior of relative paths (that they match the surrounding config\nfile).\n\nI am not opposed to coming up with a rule for relative paths in\nexcludesFile and other config options. The \"pretend as if it is next to\nthe enclosed config file\" rule is sensible to me, but that is not\nsurprising since I was the one who implemented it for includes. ;)\n\nWe'd potentially break some people's config, but I suspect such config\nis flaky already (see above).\n\nIt would be nice if this were implemented via git_config_pathname() for\nconsistency, but beware that some options already do specify a behavior\nfor relative paths, and we would have to make sure not to break that\n(e.g., see the documentation and implementation for core.hooksPath).\n\n-Peff\n"}]}