{"thread":{"id":"45588","subject":"Bug: 'git config --local user.email=<alt.email>' fails silently?","startedAt":"2017-04-02T05:53:16Z","lastAt":"2017-04-02T07:53:49Z","messageCount":3,"participants":["Knut Omang","Jeff King"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"316047","messageId":"1491112043.5830.11.camel@oracle.com","threadId":"45588","inReplyTo":null,"subject":"Bug: 'git config --local user.email=<alt.email>' fails silently?","fromName":"Knut Omang","fromEmail":"knut.omang@oracle.com","sentAt":"2017-04-02T05:47:23Z","receivedAt":"2017-04-02T05:53:16Z","isPatch":false,"sender":{"key":"knut.omang@oracle.com","avatar":null},"body":"Hi,\n\nFrom the documentation I would have expected \n\ngit config --local user.email=alt.email@alt.domain\n\nto create a section \n\n[user]\n\temail=alt.email@alt.domain\n\nin the local .git/config.\n\nInstead it returns status 1 with no error message.\n\nIs this intentional?\n\nIf I add the [user] section manually, it works as expected/desired:\nmy commits in that tree uses the alternate mail address.\n\ngit --version\ngit version 2.7.4\n\nThanks,\nKnut Omang\n\n-- \nKnut Omang, Ph.D\nPrincipal Software Engineer\nOracle Linux and Virtualization Engineering\nORACLE Norway | Olaf Helsets vei 6 | 0694 Oslo\nEmail: knut.omang@oracle.com | Phone:  +47 41 46 22 10\n\n"},{"id":"316048","messageId":"20170402073823.tudnfftbxaa6jdo5@sigill.intra.peff.net","threadId":"45588","inReplyTo":"1491112043.5830.11.camel@oracle.com","subject":"Re: Bug: 'git config --local user.email=<alt.email>' fails silently?","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2017-04-02T07:38:23Z","receivedAt":"2017-04-02T07:38:33Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Sun, Apr 02, 2017 at 07:47:23AM +0200, Knut Omang wrote:\n\n> From the documentation I would have expected \n> \n> git config --local user.email=alt.email@alt.domain\n> \n> to create a section \n> \n> [user]\n> \temail=alt.email@alt.domain\n> \n> in the local .git/config.\n\nWhen it sees one argument, git-config treats that argument as a key to\nbe retrieved. When given two, the second is a value to be set. E.g.:\n\n  $ git config foo.bar\n  $ git config foo.bar some-value\n  $ git config foo.bar\n  some-value\n\nSo your command was interpreted as a request to fetch the value, which\ndoesn't exist.\n\n> Instead it returns status 1 with no error message.\n\nHopefully that explains the response you saw; we do not emit an error\nmessage when a key isn't found, which makes it easy for scripts to do\nthings like:\n\n  value=$(git config foo.bar || echo default-value)\n\nwithout being unnecessarily noisy.\n\nUsually we'd catch an error like yours and complain, because the key is\nsyntactically invalid (\"=\" is not generally allowed in key names):\n\n  $ git config foo.bar=some-value\n  error: invalid key: foo.bar=some-value\n\nBut your argument actually _is_ a syntactically valid key, because of\nthe dots. In a three-level key like \"one.two.three\", the second level\nsubsection is allowed to contain any character (including \"=\" and more\ndots). So your \"user.email=alt.email@alt.domain\" tries to look up the\nconfig represented by:\n\n  [user \"email=alt.email@alt\"]\n  domain\n\nWhich of course did not exist.\n\n> Is this intentional?\n\nYes, everything is working as intended. The documentation in\ngit-config(1) seems to be quite poor at describing the various operating\nmodes, though.\n\n-Peff\n"},{"id":"316050","messageId":"1491119619.5830.19.camel@oracle.com","threadId":"45588","inReplyTo":"20170402073823.tudnfftbxaa6jdo5@sigill.intra.peff.net","subject":"Re: Bug: 'git config --local user.email=<alt.email>' fails silently?","fromName":"Knut Omang","fromEmail":"knut.omang@oracle.com","sentAt":"2017-04-02T07:53:39Z","receivedAt":"2017-04-02T07:53:49Z","isPatch":false,"sender":{"key":"knut.omang@oracle.com","avatar":null},"body":"On Sun, 2017-04-02 at 03:38 -0400, Jeff King wrote:\n> On Sun, Apr 02, 2017 at 07:47:23AM +0200, Knut Omang wrote:\n> \n> > From the documentation I would have expected \n> > \n> > git config --local user.email=alt.email@alt.domain\n> > \n> > to create a section \n> > \n> > [user]\n> > \temail=alt.email@alt.domain\n> > \n> > in the local .git/config.\n> \n> When it sees one argument, git-config treats that argument as a key to\n> be retrieved. When given two, the second is a value to be set. E.g.:\n> \n>   $ git config foo.bar\n>   $ git config foo.bar some-value\n>   $ git config foo.bar\n>   some-value\n> \n> So your command was interpreted as a request to fetch the value, which\n> doesn't exist.\n> \n> > Instead it returns status 1 with no error message.\n> \n> Hopefully that explains the response you saw; we do not emit an error\n> message when a key isn't found, which makes it easy for scripts to do\n> things like:\n> \n>   value=$(git config foo.bar || echo default-value)\n> \n> without being unnecessarily noisy.\n> \n> Usually we'd catch an error like yours and complain, because the key is\n> syntactically invalid (\"=\" is not generally allowed in key names):\n> \n>   $ git config foo.bar=some-value\n>   error: invalid key: foo.bar=some-value\n> \n> But your argument actually _is_ a syntactically valid key, because of\n> the dots. In a three-level key like \"one.two.three\", the second level\n> subsection is allowed to contain any character (including \"=\" and more\n> dots). So your \"user.email=alt.email@alt.domain\" tries to look up the\n> config represented by:\n> \n>   [user \"email=alt.email@alt\"]\n>   domain\n> \n> Which of course did not exist.\n> \n> > Is this intentional?\n> \n> Yes, everything is working as intended. The documentation in\n> git-config(1) seems to be quite poor at describing the various operating\n> modes, though.\n\nAh - I see! \nThanks for the quick answer and excellent explanation,\nand sorry for the confusion - I should know well that config takes\nthe write argument after a blank.\n\nI think I'll go and get myself another cup of coffee \nbefore I ask more questions anywhere...\n\nRegards,\nKnut\n\n> \n> -Peff\n"}]}