{"thread":{"id":"48425","subject":"[bug] Multiline value should error if the next line is section","startedAt":"2018-05-06T19:22:29Z","lastAt":"2018-05-06T23:25:34Z","messageCount":5,"participants":["Shulhan","Martin Ågren","brian m. carlson","SZEDER Gábor"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"346781","messageId":"20180507020348.31b473b4@kilabit.info","threadId":"48425","inReplyTo":null,"subject":"[bug] Multiline value should error if the next line is section","fromName":"Shulhan","fromEmail":"ms@kilabit.info","sentAt":"2018-05-06T19:03:48Z","receivedAt":"2018-05-06T19:22:29Z","isPatch":false,"sender":{"key":"ms@kilabit.info","avatar":"https://gravatar.com/avatar/7c1ee6694e3700fd875823c62aec25e00a70f36f47a217ccd9240a0f5f8cb25e?d=mp&s=160"},"body":"## Environment\n\nOS: Arch Linux\nGit version: git@next d54016d9e\n\n## Reproduction Steps\n\n(1) Create the following `git.config`,\n\n```\n[alias]\n        tree = --no-pager log --graph \\\n                --date=format:'%Y-%m-%d' \\\n                --pretty=format:'%C(auto,dim)%ad %<(7,trunc) %an %Creset%m %h %s %Cgreen%d%Creset' \\\n                --exclude=\"*/production\" \\\n                --exclude=\"*/dev-*\" \\\n                -n 20 \\\n[user]\n        name = Shulhan\n        email = ms@kilabit.info\n```\n\n(2) Run `git config -f git.config -l`\n\n\n## Expected Result\n\nError message,\n\n  fatal: bad config line 9 at git.config\n\n\n## Actual Result\n\nThe command print the following output,\n\n```\nalias.tree=--no-pager log --graph\n--date=format:'%Y-%m-%d'\n--pretty=format:'%C(auto,dim)%ad %<(7,trunc) %an %Creset%m %h %s %Cgreen%d%Creset' --exclude=*/production                 --exclude=*/dev-*                 -n 20 [user]\nalias.name=Shulhan\nalias.email=ms@kilabit.info\n```\n"},{"id":"346783","messageId":"CAN0heSooYuGkxP9u0Uuwu_TCEOd_pj20L05=bwwHynPOapej6g@mail.gmail.com","threadId":"48425","inReplyTo":"20180507020348.31b473b4@kilabit.info","subject":"Re: [bug] Multiline value should error if the next line is section","fromName":"Martin Ågren","fromEmail":"martin.agren@gmail.com","sentAt":"2018-05-06T20:03:10Z","receivedAt":"2018-05-06T20:03:15Z","isPatch":false,"sender":{"key":"martin.agren@gmail.com","avatar":null},"body":"Hi Shulhan\n\nThank you for your report. I'm abbreviating a bit:\n\nOn 6 May 2018 at 21:03, Shulhan <ms@kilabit.info> wrote:\n> [alias]\n>         tree = --no-pager log --graph \\\n>                 -n 20 \\\n> [user]\n>         name = Shulhan\n>\n> (2) Run `git config -f git.config -l`\n>\n> The command print the following output,\n>\n> alias.tree=--no-pager log --graph -n 20 [user]\n> alias.name=Shulhan\n\nSmall mistake, big consequences. :-)\n\nThis behavior looks correct to me, though. It seems very hard to me to\nsecond-guess what the user meant. For example, what if that third line\ncontained a \"=\"? Like:\n\n[alias]\n        huh = !dd \\\n              bs=1024 ...\n\nShould Git guess that the backslash on the second line was a mistake?\nOr maybe not, because alias.bs = \"1024 ...\" would be a useless alias?\n\nI think such guessing would be theoretically possible, but especially if\nGit guesses wrong, that could be very frustrating to fight against.\n\nMartin\n"},{"id":"346787","messageId":"20180506210943.GA953644@genre.crustytoothpaste.net","threadId":"48425","inReplyTo":"CAN0heSooYuGkxP9u0Uuwu_TCEOd_pj20L05=bwwHynPOapej6g@mail.gmail.com","subject":"Re: [bug] Multiline value should error if the next line is section","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2018-05-06T21:09:43Z","receivedAt":"2018-05-06T21:09:52Z","isPatch":false,"sender":{"key":"sandals@crustytoothpaste.net","avatar":"https://avatars.githubusercontent.com/u/497054?v=4"},"body":"On Sun, May 06, 2018 at 10:03:10PM +0200, Martin Ågren wrote:\n> This behavior looks correct to me, though. It seems very hard to me to\n> second-guess what the user meant. For example, what if that third line\n> contained a \"=\"? Like:\n> \n> [alias]\n>         huh = !dd \\\n>               bs=1024 ...\n> \n> Should Git guess that the backslash on the second line was a mistake?\n> Or maybe not, because alias.bs = \"1024 ...\" would be a useless alias?\n> \n> I think such guessing would be theoretically possible, but especially if\n> Git guesses wrong, that could be very frustrating to fight against.\n\nI agree that trying to guess what the user wanted here is likely\nimpossible.\n\nFurthermore, Git intentionally ignores unknown options.  For example, I\nhave advice and diff options set in my .gitconfig that would not be\nvalid on the Git shipped with a base CentOS 6 (which, unfortunately, I\nsometimes have to use).  It's very convenient for users working across a\nvariety of systems that unknown options are simply ignored, even if that\nmeans sometimes mistakes are not caught.\n-- \nbrian m. carlson: Houston, Texas, US\nOpenPGP: https://keybase.io/bk2204\n"},{"id":"346789","messageId":"20180507060322.66b121bd@kilabit.info","threadId":"48425","inReplyTo":"CAN0heSooYuGkxP9u0Uuwu_TCEOd_pj20L05=bwwHynPOapej6g@mail.gmail.com","subject":"Re: [bug] Multiline value should error if the next line is section","fromName":"Shulhan","fromEmail":"ms@kilabit.info","sentAt":"2018-05-06T23:03:22Z","receivedAt":"2018-05-06T23:03:35Z","isPatch":false,"sender":{"key":"ms@kilabit.info","avatar":"https://gravatar.com/avatar/7c1ee6694e3700fd875823c62aec25e00a70f36f47a217ccd9240a0f5f8cb25e?d=mp&s=160"},"body":"On Sun, 6 May 2018 22:03:10 +0200\nMartin Ågren <martin.agren@gmail.com> wrote:\n\n> Hi Shulhan\n> \n> Thank you for your report. I'm abbreviating a bit:\n> \n> On 6 May 2018 at 21:03, Shulhan <ms@kilabit.info> wrote:\n> > [alias]\n> >         tree = --no-pager log --graph \\\n> >                 -n 20 \\\n> > [user]\n> >         name = Shulhan\n> >\n> > (2) Run `git config -f git.config -l`\n> >\n> > The command print the following output,\n> >\n> > alias.tree=--no-pager log --graph -n 20 [user]\n> > alias.name=Shulhan  \n> \n> Small mistake, big consequences. :-)\n> \n> This behavior looks correct to me, though. It seems very hard to me to\n> second-guess what the user meant. For example, what if that third line\n> contained a \"=\"? Like:\n> \n> [alias]\n>         huh = !dd \\\n>               bs=1024 ...\n> \n> Should Git guess that the backslash on the second line was a mistake?\n> Or maybe not, because alias.bs = \"1024 ...\" would be a useless alias?\n\nThe context of multiline next value that I reported before was\nabout section, not variable.\n\n> \n> I think such guessing would be theoretically possible, but especially\n> if Git guesses wrong, that could be very frustrating to fight against.\n> \n\nI'm not familiar with git config parser, obviously :), but checking\nthe start of next multiline value that start with '[' maybe not\nimpossible. Git should not guessed, but report error at the\noffending line: either user forgot to enclosed the variable with\ndouble quote or they missplace the backslash.\n"},{"id":"346820","messageId":"20180506232514.3065-1-szeder.dev@gmail.com","threadId":"48425","inReplyTo":"20180507060322.66b121bd@kilabit.info","subject":"Re: [bug] Multiline value should error if the next line is section","fromName":"SZEDER Gábor","fromEmail":"szeder.dev@gmail.com","sentAt":"2018-05-06T23:25:14Z","receivedAt":"2018-05-06T23:25:34Z","isPatch":false,"sender":{"key":"szeder.dev@gmail.com","avatar":"https://avatars.githubusercontent.com/u/116324?v=4"},"body":"\n> On Sun, 6 May 2018 22:03:10 +0200\n> Martin Ågren <martin.agren@gmail.com> wrote:\n> > On 6 May 2018 at 21:03, Shulhan <ms@kilabit.info> wrote:\n> > > [alias]\n> > >         tree = --no-pager log --graph \\\n> > >                 -n 20 \\\n> > > [user]\n> > >         name = Shulhan\n> > >\n> > > (2) Run `git config -f git.config -l`\n> > >\n> > > The command print the following output,\n> > >\n> > > alias.tree=--no-pager log --graph -n 20 [user]\n> > > alias.name=Shulhan  \n> > \n> > Small mistake, big consequences. :-)\n> > \n> > This behavior looks correct to me, though. It seems very hard to me to\n> > second-guess what the user meant. For example, what if that third line\n> > contained a \"=\"? Like:\n> > \n> > [alias]\n> >         huh = !dd \\\n> >               bs=1024 ...\n> > \n> > Should Git guess that the backslash on the second line was a mistake?\n> > Or maybe not, because alias.bs = \"1024 ...\" would be a useless alias?\n> \n> The context of multiline next value that I reported before was\n> about section, not variable.\n> \n> > \n> > I think such guessing would be theoretically possible, but especially\n> > if Git guesses wrong, that could be very frustrating to fight against.\n> > \n> \n> I'm not familiar with git config parser, obviously :), but checking\n> the start of next multiline value that start with '[' maybe not\n> impossible. Git should not guessed, but report error at the\n> offending line: either user forgot to enclosed the variable with\n> double quote or they missplace the backslash.\n\nBut it's not an error; as far as the config file syntax is concerned,\nit's perfectly valid, even if it's not what you intended.  Reporting it\nas error would be just guessing. \n\n"}]}