{"thread":{"id":"29326","subject":"git-send-email: bug with sendemail.multiedit","startedAt":"2012-01-09T19:09:30Z","lastAt":"2012-01-10T14:23:59Z","messageCount":5,"participants":["Jean-Francois Dagenais","Jeff King","Junio C Hamano","Thomas Rast"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"182173","messageId":"1AC16B4B-8376-4A50-A900-BB8E704FAB82@gmail.com","threadId":"29326","inReplyTo":null,"subject":"git-send-email: bug with sendemail.multiedit","fromName":"Jean-Francois Dagenais","fromEmail":"jeff.dagenais@gmail.com","sentAt":"2012-01-09T19:09:30Z","receivedAt":"2012-01-09T19:09:30Z","isPatch":false,"sender":{"key":"jeff.dagenais@gmail.com","avatar":null},"body":"Bonjour Pierre! ... and all git developers!\n\nI think there is a bug with git-send-email.perl's evaluation of the sendemail.multiedit config variable.\n\nI was only able to make the \"do_edit()\" function detect it as false by setting the variable to \"0\" instead\nof \"false\", like so:\n\ngit config --global sendemail.multiedit 0\n\notherwise do_edit evaluates it as true and invokes the editor with all files as argument.\n\nAll other git config boolean variables are set to either \"true\" or \"false\", not \"0\" or \"1\".\n\nNot being too familiar with the perl language, I don't know how to fix this without spending an hour, which\nis probably the amount of time I already spent narrowing the problem down already. So I leave this into\nmore capable hands.\n\ncheers."},{"id":"182189","messageId":"20120109225542.GB9902@sigill.intra.peff.net","threadId":"29326","inReplyTo":"1AC16B4B-8376-4A50-A900-BB8E704FAB82@gmail.com","subject":"Re: git-send-email: bug with sendemail.multiedit","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2012-01-09T22:55:42Z","receivedAt":"2012-01-09T22:55:42Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Mon, Jan 09, 2012 at 02:09:30PM -0500, Jean-Francois Dagenais wrote:\n\n> I think there is a bug with git-send-email.perl's evaluation of the\n> sendemail.multiedit config variable.\n> \n> I was only able to make the \"do_edit()\" function detect it as false by\n> setting the variable to \"0\" instead of \"false\", like so:\n\nI think it's this:\n\n-- >8 --\nSubject: [PATCH] send-email: multiedit is a boolean config option\n\nThe sendemail.multiedit variable is meant to be a boolean.\nHowever, it is not marked as such in the code, which means\nwe store its value literally. Thus in the do_edit function,\nperl ends up coercing it to a boolean value according to\nperl rules, not git rules. This works for \"0\", but \"false\",\n\"no\", or \"off\" will erroneously be interpreted as true.\n\nSigned-off-by: Jeff King <peff@peff.net>\n---\n git-send-email.perl |    2 +-\n 1 files changed, 1 insertions(+), 1 deletions(-)\n\ndiff --git a/git-send-email.perl b/git-send-email.perl\nindex d491db9..ef30c55 100755\n--- a/git-send-email.perl\n+++ b/git-send-email.perl\n@@ -210,6 +210,7 @@ my %config_bool_settings = (\n     \"signedoffbycc\" => [\\$signed_off_by_cc, undef],\n     \"signedoffcc\" => [\\$signed_off_by_cc, undef],      # Deprecated\n     \"validate\" => [\\$validate, 1],\n+    \"multiedit\" => [\\$multiedit, undef]\n );\n \n my %config_settings = (\n@@ -227,7 +228,6 @@ my %config_settings = (\n     \"bcc\" => \\@bcclist,\n     \"suppresscc\" => \\@suppress_cc,\n     \"envelopesender\" => \\$envelope_sender,\n-    \"multiedit\" => \\$multiedit,\n     \"confirm\"   => \\$confirm,\n     \"from\" => \\$sender,\n     \"assume8bitencoding\" => \\$auto_8bit_encoding,\n-- \n1.7.8\n"},{"id":"182190","messageId":"7vobuccvsm.fsf@alter.siamese.dyndns.org","threadId":"29326","inReplyTo":"20120109225542.GB9902@sigill.intra.peff.net","subject":"Re: git-send-email: bug with sendemail.multiedit","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-01-09T23:15:21Z","receivedAt":"2012-01-09T23:15:21Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jeff King <peff@peff.net> writes:\n\n> On Mon, Jan 09, 2012 at 02:09:30PM -0500, Jean-Francois Dagenais wrote:\n>\n>> I think there is a bug with git-send-email.perl's evaluation of the\n>> sendemail.multiedit config variable.\n>> \n>> I was only able to make the \"do_edit()\" function detect it as false by\n>> setting the variable to \"0\" instead of \"false\", like so:\n>\n> I think it's this:\n>\n> -- >8 --\n> Subject: [PATCH] send-email: multiedit is a boolean config option\n>\n> The sendemail.multiedit variable is meant to be a boolean.\n> However, it is not marked as such in the code, which means\n> we store its value literally. Thus in the do_edit function,\n> perl ends up coercing it to a boolean value according to\n> perl rules, not git rules. This works for \"0\", but \"false\",\n> \"no\", or \"off\" will erroneously be interpreted as true.\n>\n> Signed-off-by: Jeff King <peff@peff.net>\n> ---\n\nLooks like it.\n\nAnd in case anybody is wondering by looking at the context, confirm is not\na boolean \"do you want a confirmation or not?\", so it can stay where it is.\n\nThanks.\n\n>  git-send-email.perl |    2 +-\n>  1 files changed, 1 insertions(+), 1 deletions(-)\n>\n> diff --git a/git-send-email.perl b/git-send-email.perl\n> index d491db9..ef30c55 100755\n> --- a/git-send-email.perl\n> +++ b/git-send-email.perl\n> @@ -210,6 +210,7 @@ my %config_bool_settings = (\n>      \"signedoffbycc\" => [\\$signed_off_by_cc, undef],\n>      \"signedoffcc\" => [\\$signed_off_by_cc, undef],      # Deprecated\n>      \"validate\" => [\\$validate, 1],\n> +    \"multiedit\" => [\\$multiedit, undef]\n>  );\n>  \n>  my %config_settings = (\n> @@ -227,7 +228,6 @@ my %config_settings = (\n>      \"bcc\" => \\@bcclist,\n>      \"suppresscc\" => \\@suppress_cc,\n>      \"envelopesender\" => \\$envelope_sender,\n> -    \"multiedit\" => \\$multiedit,\n>      \"confirm\"   => \\$confirm,\n>      \"from\" => \\$sender,\n>      \"assume8bitencoding\" => \\$auto_8bit_encoding,\n"},{"id":"182220","messageId":"87sjjnlw2d.fsf@thomas.inf.ethz.ch","threadId":"29326","inReplyTo":"1AC16B4B-8376-4A50-A900-BB8E704FAB82@gmail.com","subject":"Re: git-send-email: bug with sendemail.multiedit","fromName":"Thomas Rast","fromEmail":"trast@student.ethz.ch","sentAt":"2012-01-10T09:56:58Z","receivedAt":"2012-01-10T09:56:58Z","isPatch":false,"sender":{"key":"tr@thomasrast.ch","avatar":"https://avatars.githubusercontent.com/u/153510?v=4"},"body":"Jean-Francois Dagenais <jeff.dagenais@gmail.com> writes:\n\n> Bonjour Pierre! ... and all git developers!\n>\n> I think there is a bug with git-send-email.perl's evaluation of the sendemail.multiedit config variable.\n>\n> I was only able to make the \"do_edit()\" function detect it as false by setting the variable to \"0\" instead\n> of \"false\", like so:\n>\n> git config --global sendemail.multiedit 0\n>\n> otherwise do_edit evaluates it as true and invokes the editor with all files as argument.\n\nThe patch below looks like the obvious fix.  Perhaps you can test it?\n\ndiff --git i/git-send-email.perl w/git-send-email.perl\nindex d491db9..7ac0a7d 100755\n--- i/git-send-email.perl\n+++ w/git-send-email.perl\n@@ -210,6 +210,7 @@ sub do_edit {\n     \"signedoffbycc\" => [\\$signed_off_by_cc, undef],\n     \"signedoffcc\" => [\\$signed_off_by_cc, undef],      # Deprecated\n     \"validate\" => [\\$validate, 1],\n+    \"multiedit\" => [\\$multiedit, undef],\n );\n \n my %config_settings = (\n@@ -227,7 +228,6 @@ sub do_edit {\n     \"bcc\" => \\@bcclist,\n     \"suppresscc\" => \\@suppress_cc,\n     \"envelopesender\" => \\$envelope_sender,\n-    \"multiedit\" => \\$multiedit,\n     \"confirm\"   => \\$confirm,\n     \"from\" => \\$sender,\n     \"assume8bitencoding\" => \\$auto_8bit_encoding,\n\n-- \nThomas Rast\ntrast@{inf,student}.ethz.ch\n"},{"id":"182239","messageId":"B281FA72-A179-4782-A439-02A71B1C61BF@gmail.com","threadId":"29326","inReplyTo":"20120109225542.GB9902@sigill.intra.peff.net","subject":"Re: git-send-email: bug with sendemail.multiedit","fromName":"Jean-Francois Dagenais","fromEmail":"jeff.dagenais@gmail.com","sentAt":"2012-01-10T14:23:59Z","receivedAt":"2012-01-10T14:23:59Z","isPatch":false,"sender":{"key":"jeff.dagenais@gmail.com","avatar":null},"body":"Tested with 0/1/true/false, all works as expected, i.e. fix is backward compatible.\ngit version 1.7.8.2\n\nOn Jan 9, 2012, at 17:55, Jeff King wrote:\n\n> On Mon, Jan 09, 2012 at 02:09:30PM -0500, Jean-Francois Dagenais wrote:\n> \n>> I think there is a bug with git-send-email.perl's evaluation of the\n>> sendemail.multiedit config variable.\n>> \n>> I was only able to make the \"do_edit()\" function detect it as false by\n>> setting the variable to \"0\" instead of \"false\", like so:\n> \n> I think it's this:\n> \n> -- >8 --\n> Subject: [PATCH] send-email: multiedit is a boolean config option\n> \n> The sendemail.multiedit variable is meant to be a boolean.\n> However, it is not marked as such in the code, which means\n> we store its value literally. Thus in the do_edit function,\n> perl ends up coercing it to a boolean value according to\n> perl rules, not git rules. This works for \"0\", but \"false\",\n> \"no\", or \"off\" will erroneously be interpreted as true.\n> \n> Signed-off-by: Jeff King <peff@peff.net>\nTested-by: Jean-François Dagenais <jeff.dagenais@gmail.com>\n> ---\n> git-send-email.perl |    2 +-\n> 1 files changed, 1 insertions(+), 1 deletions(-)\n> \n> diff --git a/git-send-email.perl b/git-send-email.perl\n> index d491db9..ef30c55 100755\n> --- a/git-send-email.perl\n> +++ b/git-send-email.perl\n> @@ -210,6 +210,7 @@ my %config_bool_settings = (\n>     \"signedoffbycc\" => [\\$signed_off_by_cc, undef],\n>     \"signedoffcc\" => [\\$signed_off_by_cc, undef],      # Deprecated\n>     \"validate\" => [\\$validate, 1],\n> +    \"multiedit\" => [\\$multiedit, undef]\n> );\n> \n> my %config_settings = (\n> @@ -227,7 +228,6 @@ my %config_settings = (\n>     \"bcc\" => \\@bcclist,\n>     \"suppresscc\" => \\@suppress_cc,\n>     \"envelopesender\" => \\$envelope_sender,\n> -    \"multiedit\" => \\$multiedit,\n>     \"confirm\"   => \\$confirm,\n>     \"from\" => \\$sender,\n>     \"assume8bitencoding\" => \\$auto_8bit_encoding,\n> -- \n> 1.7.8\n> \n"}]}