{"thread":{"id":"32222","subject":"git config key bug or by design?","startedAt":"2012-11-28T03:14:46Z","lastAt":"2012-11-28T20:21:58Z","messageCount":4,"participants":["Peter van der Does","Jeff King"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"204114","messageId":"20121127221446.7f2fbf71@Indy","threadId":"32222","inReplyTo":null,"subject":"git config key bug or by design?","fromName":"Peter van der Does","fromEmail":"peter@avirtualhome.com","sentAt":"2012-11-28T03:14:46Z","receivedAt":"2012-11-28T03:14:46Z","isPatch":false,"sender":{"key":"peter@avirtualhome.com","avatar":"https://avatars.githubusercontent.com/u/380071?v=4"},"body":"I noticed today I can't create a key starting with a number.\n\nThe source code[1] confirms this, but is this a bug or is it by design?\n\n\n[1]: https://github.com/git/git/blob/master/config.c#L1265\n\n-- \nPeter van der Does\n\nGPG key: CB317D6E\n\nIRC: Ganseki on irc.freenode.net\nTwitter: @petervanderdoes\n"},{"id":"204121","messageId":"20121128033408.GE27772@sigill.intra.peff.net","threadId":"32222","inReplyTo":"20121127221446.7f2fbf71@Indy","subject":"Re: git config key bug or by design?","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2012-11-28T03:34:09Z","receivedAt":"2012-11-28T03:34:09Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Tue, Nov 27, 2012 at 10:14:46PM -0500, Peter van der Does wrote:\n\n> I noticed today I can't create a key starting with a number.\n> \n> The source code[1] confirms this, but is this a bug or is it by design?\n\nI don't recall ever discussing it. But what is it that you want to store\nin a key starting with a number? Git does not respect any such config\nvalues[1].\n\nAre you writing a new tool that will store its config alongside git's?\nEven if the behavior is loosened, you would probably want to avoid\nstarting your config keys with numbers, as older git versions would be\naround for a while and would choke on it.\n\n-Peff\n\n[1] You can still store arbitrary bytes in the subsection name (e.g.,\n    \"foo.123.bar\").\n"},{"id":"204155","messageId":"20121128071147.188a869e@Indy","threadId":"32222","inReplyTo":"20121128033408.GE27772@sigill.intra.peff.net","subject":"Re: git config key bug or by design?","fromName":"Peter van der Does","fromEmail":"peter@avirtualhome.com","sentAt":"2012-11-28T12:11:47Z","receivedAt":"2012-11-28T12:11:47Z","isPatch":false,"sender":{"key":"peter@avirtualhome.com","avatar":"https://avatars.githubusercontent.com/u/380071?v=4"},"body":"On Tue, 27 Nov 2012 22:34:09 -0500\nJeff King <peff@peff.net> wrote:\n> \n> I don't recall ever discussing it. But what is it that you want to\n> store in a key starting with a number? Git does not respect any such\n> config values[1].\n> \n> Are you writing a new tool that will store its config alongside git's?\n> Even if the behavior is loosened, you would probably want to avoid\n> starting your config keys with numbers, as older git versions would be\n> around for a while and would choke on it.\n> \n> -Peff\n> \n> [1] You can still store arbitrary bytes in the subsection name (e.g.,\n>     \"foo.123.bar\").\n\nI am writing a tool, it needs to store branch names in a separate config\nfile. \n\nIt's clear git doesn't respect those values, hence my question. I\nunderstand how to work around the problem, I would just prefix the key.\nI was just wondering if it was by design, which I guess it is as the\nparsing of the file will die if the key starts with a non-alpha\ncharacter.\n\n\n-- \nPeter van der Does\n\nGPG key: CB317D6E\n\nIRC: Ganseki on irc.freenode.net\nTwitter: @petervanderdoes\n"},{"id":"204199","messageId":"20121128202158.GB9249@sigill.intra.peff.net","threadId":"32222","inReplyTo":"20121128071147.188a869e@Indy","subject":"Re: git config key bug or by design?","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2012-11-28T20:21:58Z","receivedAt":"2012-11-28T20:21:58Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Wed, Nov 28, 2012 at 07:11:47AM -0500, Peter van der Does wrote:\n\n> I am writing a tool, it needs to store branch names in a separate config\n> file.\n> \n> It's clear git doesn't respect those values, hence my question. I\n> understand how to work around the problem, I would just prefix the key.\n> I was just wondering if it was by design, which I guess it is as the\n> parsing of the file will die if the key starts with a non-alpha\n> character.\n\nIn that case, I would definitely say to use some prefix section like\n\"section.$branchname.key\". That is how git stores per-branch information\n(e.g., branch.master.merge), and it was always designed to let there be\narbitrary data in the \"middle\" section, whereas the section and key are\nrestricted and case-insensitive.\n\nSo no, I do not recall \"cannot start with number\" as a specific design\ndecision, but it is definitely a design decision that the section name\nwould not allow arbitrary content.\n\n-Peff\n"}]}