{"thread":{"id":"66721","subject":"sharp edges in Git configuration files","startedAt":"2026-10-31T02:56:44Z","lastAt":"2026-10-31T17:26:52Z","messageCount":2,"participants":["Chris Torek","brian m. carlson"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"556986","messageId":"CAPx1Gvd3rAcgDf-rBPOuZFf2=Y+=JxJDdr6AJTvdtpL6Vsk43w@mail.gmail.com","threadId":"66721","inReplyTo":null,"subject":"sharp edges in Git configuration files","fromName":"Chris Torek","fromEmail":"chris.torek@gmail.com","sentAt":"2026-10-31T02:56:44Z","receivedAt":"2026-10-31T02:56:44Z","isPatch":false,"sender":{"key":"chris.torek@gmail.com","avatar":"https://avatars.githubusercontent.com/u/16826774?v=4"},"body":"(let's try this again and see if gmail html-izes AGAIN on me...)\n\nThis isn't any kind of serious bug, but I have been playing with Git\nconfiguration files to determine a lot of precise details about\nbehavior when reading or changing them, both with \"git config\" and\nwith the implicit changes made by \"git branch\", \"git remote\", and\nother internal operations.\n\nAnyway, one edge case that causes problems occurs if a user manually\nedits a \".git/config\" file to add include directives. For instance,\nit's possible to take one or more [remote] or [branch] sections out\ninto a separate file.  The following \"ed\" command will do this (not\nvery safely, don't do it on any repo you care about, just in case):\n\ned - .git/config <<'END'\n/^\\[remote /,$w .git/inc-remote\n/^\\[remote /,$d\na\n[include]\n        path = inc-remote\n.\nw\nq\nEND\n\nafter which some \"git remote\" operations that try to update the\nremotes just fail bizarrely.\n\n(Note: gmail may have whacked white space above, I've set it to send\nplain text but gmail is...what it is.)\n\nThe obvious thing with \"doctor it hurts when I do this\" is of course\n\"well don't do that\", and nobody should be splitting their .git/config\ninto multiple included sub-config-files. But, in the spirit of robust\nsoftware (and perhaps just as leftover bits?), it might be wise to\nmake Git ignore include lines in config files that are intended to be\nGit-managed directly, such as .git/config.\n\nChris\n\n"},{"id":"557037","messageId":"auYk201o4foYWl2d@fruit.crustytoothpaste.net","threadId":"66721","inReplyTo":"CAPx1Gvd3rAcgDf-rBPOuZFf2=Y+=JxJDdr6AJTvdtpL6Vsk43w@mail.gmail.com","subject":"Re: sharp edges in Git configuration files","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2026-10-31T17:26:52Z","receivedAt":"2026-10-31T17:26:52Z","isPatch":false,"sender":{"key":"sandals@crustytoothpaste.net","avatar":"https://avatars.githubusercontent.com/u/497054?v=4"},"body":"On 2026-10-31 at 02:56:44, Chris Torek wrote:\n> The obvious thing with \"doctor it hurts when I do this\" is of course\n> \"well don't do that\", and nobody should be splitting their .git/config\n> into multiple included sub-config-files. But, in the spirit of robust\n> software (and perhaps just as leftover bits?), it might be wise to\n> make Git ignore include lines in config files that are intended to be\n> Git-managed directly, such as .git/config.\n\nI actually believe we're using includes for `.git/config` in some cases\nat work and I'm pretty sure my colleagues do want them to continue to\nwork.\n\nI don't know exactly why they're doing that, since I'm not intimately\ninvolved with that project, but I will point out that our fork of Git\nhas a checksum that includes the `config` file (but not included files)\nand that must be in sync across replicas, so they may be doing so to\ntest out a config setting on a particular host during development.  In\nany event, I'd say that while it may seem bizarre, some people might\nwant to do this for other reasons[0], so we probably shouldn't break it.\n\n[0] One reason I can imagine is personal configuration (via\n`path=~/...`) in large shared repositories.  Yes, people shouldn't be\ndoing that, but we know they do.\n-- \nbrian m. carlson (they/them)\nToronto, Ontario, CA\nSpeaking for myself only\n"}]}