{"thread":{"id":"20410","subject":"[PATCH] send-email: confirm on empty mail subjects","startedAt":"2009-08-05T16:49:54Z","lastAt":"2009-09-11T23:27:03Z","messageCount":7,"participants":["Jan Engelhardt","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"119630","messageId":"1249490994-23455-1-git-send-email-jengelh@medozas.de","threadId":"20410","inReplyTo":null,"subject":"[PATCH] send-email: confirm on empty mail subjects","fromName":"Jan Engelhardt","fromEmail":"jengelh@medozas.de","sentAt":"2009-08-05T16:49:54Z","receivedAt":"2009-08-05T16:49:54Z","isPatch":true,"sender":{"key":"jengelh@medozas.de","avatar":null},"body":"When the user forgot to enter a subject in a compose session,\nsend-email will now inquire whether this is really intended, similar\nto what the Alpine MUA does when a subject is absent.\n\nSigned-off-by: Jan Engelhardt <jengelh@medozas.de>\n---\n git-send-email.perl |   25 ++++++++++++++++++++-----\n 1 files changed, 20 insertions(+), 5 deletions(-)\n\ndiff --git a/git-send-email.perl b/git-send-email.perl\nindex d508f83..7d56fba 100755\n--- a/git-send-email.perl\n+++ b/git-send-email.perl\n@@ -553,11 +553,26 @@ EOT\n \t}\n \tclose(C);\n \n-\tif ($annotate) {\n-\t\tdo_edit($compose_filename, @files);\n-\t} else {\n-\t\tdo_edit($compose_filename);\n-\t}\n+\tmy $re_edit = 0;\n+\tdo {\n+\t\tif ($annotate) {\n+\t\t\tdo_edit($compose_filename, @files);\n+\t\t} else {\n+\t\t\tdo_edit($compose_filename);\n+\t\t}\n+\n+\t\topen(C, \"<\", $compose_filename) ||\n+\t\t\tdie \"Failed to open $compose_filename: $!\";\n+\t\tif (grep(/^Subject:\\s*$/i, <C>)) {\n+\t\t\tmy $r = ask(\"No Subject, send anyway? \".\n+\t\t\t            \"([y]es|[n]o|[e]dit again): \",\n+\t\t\t            valid_re => qr/^[yne]/i,\n+\t\t\t            default => \"n\");\n+\t\t\t$re_edit = lc(substr($r, 0, 1)) eq \"e\";\n+\t\t\texit(0) if lc(substr($r, 0, 1)) eq \"n\";\n+\t\t}\n+\t\tclose C;\n+\t} while ($re_edit);\n \n \topen(C2,\">\",$compose_filename . \".final\")\n \t\tor die \"Failed to open $compose_filename.final : \" . $!;\n-- \n1.6.4\n"},{"id":"119754","messageId":"7vhbwlpigo.fsf@alter.siamese.dyndns.org","threadId":"20410","inReplyTo":"1249490994-23455-1-git-send-email-jengelh@medozas.de","subject":"Re: [PATCH] send-email: confirm on empty mail subjects","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-08-06T06:25:11Z","receivedAt":"2009-08-06T06:25:11Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jan Engelhardt <jengelh@medozas.de> writes:\n\n> When the user forgot to enter a subject in a compose session,\n> send-email will now inquire whether this is really intended, similar\n> to what the Alpine MUA does when a subject is absent.\n\nThis seems to break t9001...\n"},{"id":"121654","messageId":"alpine.LSU.2.00.0908241927300.5382@fbirervta.pbzchgretzou.qr","threadId":"20410","inReplyTo":"7vhbwlpigo.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH] send-email: confirm on empty mail subjects","fromName":"Jan Engelhardt","fromEmail":"jengelh@medozas.de","sentAt":"2009-08-24T17:27:56Z","receivedAt":"2009-08-24T17:27:56Z","isPatch":true,"sender":{"key":"jengelh@medozas.de","avatar":null},"body":"On Thursday 2009-08-06 08:25, Junio C Hamano wrote:\n\n>Jan Engelhardt <jengelh@medozas.de> writes:\n>\n>> When the user forgot to enter a subject in a compose session,\n>> send-email will now inquire whether this is really intended, similar\n>> to what the Alpine MUA does when a subject is absent.\n>\n>This seems to break t9001...\n>\n\nDid I miss something in building?\n\n19:26 sovereign:../git/git-1.6.4.1 > quilt pu\nApplying patch patches/send-email-empty-subject.diff\npatching file git-send-email.perl\n\nNow at patch patches/send-email-empty-subject.diff\n19:26 sovereign:../git/git-1.6.4.1 > cd t\n19:26 sovereign:../git-1.6.4.1/t > ./t9001-send-email.sh \n*   ok 1: prepare reference tree\n*   ok 2: Setup helper tool\n*   ok 3: Extract patches\n*   ok 4: No confirm with --suppress-cc\n*   ok 5: No confirm with --confirm=never\n*   ok 6: No confirm with sendemail.confirm=never\n*   ok 7: Send patches\n*   ok 8: Verify commandline\n*   ok 9: Show all headers\n*   ok 10: Prompting works\n*   ok 11: cccmd works\n*   ok 12: reject long lines\n*   ok 13: no patch was sent\n*   ok 14: Author From: in message body\n*   ok 15: Author From: not in message body\n*   ok 16: allow long lines with --no-validate\n*   ok 17: Invalid In-Reply-To\n*   ok 18: Valid In-Reply-To when prompting\n*   ok 19: setup fake editor\n*   ok 20: --compose works\n*   ok 21: first message is compose text\n*   ok 22: second message is patch\n*   ok 23: sendemail.cc set\n*   ok 24: sendemail.cc unset\n*   ok 25: sendemail.cccmd\n*   ok 26: --suppress-cc=all\n*   ok 27: --suppress-cc=body\n*   ok 28: --suppress-cc=body --suppress-cc=cccmd\n*   ok 29: --suppress-cc=sob\n*   ok 30: --suppress-cc=bodycc\n*   ok 31: --suppress-cc=cc\n*   ok 32: --confirm=always\n*   ok 33: --confirm=auto\n*   ok 34: --confirm=cc\n*   ok 35: --confirm=compose\n*   ok 36: confirm by default (due to cc)\n*   ok 37: confirm by default (due to --compose)\n*   ok 38: confirm detects EOF (inform assumes y)\n*   ok 39: confirm detects EOF (auto causes failure)\n*   ok 40: confirm doesnt loop forever\n*   ok 41: utf8 Cc is rfc2047 encoded\n*   ok 42: --compose adds MIME for utf8 body\n*   ok 43: --compose respects user mime type\n*   ok 44: --compose adds MIME for utf8 subject\n*   ok 45: detects ambiguous reference/file conflict\n*   ok 46: feed two files\n*   ok 47: in-reply-to but no threading\n*   ok 48: no in-reply-to and no threading\n*   ok 49: threading but no chain-reply-to\n* passed all 49 test(s)\n"},{"id":"121656","messageId":"7v1vn1gjlp.fsf@alter.siamese.dyndns.org","threadId":"20410","inReplyTo":"alpine.LSU.2.00.0908241927300.5382@fbirervta.pbzchgretzou.qr","subject":"Re: [PATCH] send-email: confirm on empty mail subjects","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-08-24T18:19:46Z","receivedAt":"2009-08-24T18:19:46Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jan Engelhardt <jengelh@medozas.de> writes:\n\n> On Thursday 2009-08-06 08:25, Junio C Hamano wrote:\n>\n>>Jan Engelhardt <jengelh@medozas.de> writes:\n>>\n>>> When the user forgot to enter a subject in a compose session,\n>>> send-email will now inquire whether this is really intended, similar\n>>> to what the Alpine MUA does when a subject is absent.\n>>\n>>This seems to break t9001...\n>>\n>\n> Did I miss something in building?\n>\n> 19:26 sovereign:../git/git-1.6.4.1 > quilt pu\n> Applying patch patches/send-email-empty-subject.diff\n> patching file git-send-email.perl\n\nIs this using 'pu' with your patch?  Near the tip of the 'pu' branch I\nhave a iffy workaround to \"unbreak\" the issue, but it is a rather\nsledgehammer approach I do not feel comfortable enough to squash into your\npatch yet.\n"},{"id":"121733","messageId":"alpine.LSU.2.00.0908251825150.21065@fbirervta.pbzchgretzou.qr","threadId":"20410","inReplyTo":"7v1vn1gjlp.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH] send-email: confirm on empty mail subjects","fromName":"Jan Engelhardt","fromEmail":"jengelh@medozas.de","sentAt":"2009-08-25T16:27:48Z","receivedAt":"2009-08-25T16:27:48Z","isPatch":true,"sender":{"key":"jengelh@medozas.de","avatar":null},"body":"\nOn Montag 2009-08-24 20:19, Junio C Hamano wrote:\n>>>\n>>>> When the user forgot to enter a subject in a compose session,\n>>>> send-email will now inquire whether this is really intended, similar\n>>>> to what the Alpine MUA does when a subject is absent.\n>>>\n>>>This seems to break t9001...\n>>\n>> Did I miss something in building?\n>>\n>> 19:26 sovereign:../git/git-1.6.4.1 > quilt pu\n>> Applying patch patches/send-email-empty-subject.diff\n>> patching file git-send-email.perl\n>\n>Is this using 'pu' with your patch?\n\nAh no, `quilt pu` is an autoalias for `quilt push`.\n\n>Near the tip of the 'pu' branch I\n>have a iffy workaround to \"unbreak\" the issue, but it is a rather\n>sledgehammer approach I do not feel comfortable enough to squash into your\n>patch yet.\n\nI see. Perhaps\n\n\techo -en 'y\\ny\\n' | ...\n\nwould be more gentle? (Noting that, how else should it be,\nmany a shell do not have -e/-n again.)\n"},{"id":"121737","messageId":"7veiqzpzjn.fsf@alter.siamese.dyndns.org","threadId":"20410","inReplyTo":"alpine.LSU.2.00.0908251825150.21065@fbirervta.pbzchgretzou.qr","subject":"Re: [PATCH] send-email: confirm on empty mail subjects","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-08-25T17:35:08Z","receivedAt":"2009-08-25T17:35:08Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jan Engelhardt <jengelh@medozas.de> writes:\n\n>>Near the tip of the 'pu' branch I\n>>have a iffy workaround to \"unbreak\" the issue, but it is a rather\n>>sledgehammer approach I do not feel comfortable enough to squash into your\n>>patch yet.\n>\n> I see. Perhaps\n>\n> \techo -en 'y\\ny\\n' | ...\n>\n> would be more gentle? (Noting that, how else should it be,\n> many a shell do not have -e/-n again.)\n\nYou can solve it with printf \"y\\ny\\n\", but the reason I said it feels\nwrong was because your added tests are the _only_ ones that expect more\nthan one \"yes\".\n\nIf some _other_ tests that currently need only one \"yes\" are broken in the\nfuture and starts asking for more than one, we would like to know about\nthe breakage, but we won't notice it if we unconditionally fed \"yes | ...\"\nor your \"two y's | ...\" to them.  That is what I am unhappy about the\n\"iffy workaround\".\n"},{"id":"122925","messageId":"7v4or9qczc.fsf@alter.siamese.dyndns.org","threadId":"20410","inReplyTo":"1249490994-23455-1-git-send-email-jengelh@medozas.de","subject":"Re: [PATCH] send-email: confirm on empty mail subjects","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-09-11T23:27:03Z","receivedAt":"2009-09-11T23:27:03Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jan Engelhardt <jengelh@medozas.de> writes:\n\n> When the user forgot to enter a subject in a compose session,\n> send-email will now inquire whether this is really intended, similar\n> to what the Alpine MUA does when a subject is absent.\n>\n> Signed-off-by: Jan Engelhardt <jengelh@medozas.de>\n> ---\n>  git-send-email.perl |   25 ++++++++++++++++++++-----\n>  1 files changed, 20 insertions(+), 5 deletions(-)\n\nWe have had this for quite a long time but I have two niggling worries,\none minor, another one showstopper from maintainability point of view.\n\n - With --confirm=never the program still seems to talk with the terminal.\n   I think with --confirm=neber we should not ask but just fail.\n\n - This does not hook into the confirmation framework the program already\n   has, and does not have any way to turn it off.\n\n> diff --git a/git-send-email.perl b/git-send-email.perl\n> index d508f83..7d56fba 100755\n> --- a/git-send-email.perl\n> +++ b/git-send-email.perl\n> @@ -553,11 +553,26 @@ EOT\n>  \t}\n>  \tclose(C);\n>  \n> -\tif ($annotate) {\n> -\t\tdo_edit($compose_filename, @files);\n> -\t} else {\n> -\t\tdo_edit($compose_filename);\n> -\t}\n> +\tmy $re_edit = 0;\n> +\tdo {\n> +\t\tif ($annotate) {\n> +\t\t\tdo_edit($compose_filename, @files);\n> +\t\t} else {\n> +\t\t\tdo_edit($compose_filename);\n> +\t\t}\n> +\n> +\t\topen(C, \"<\", $compose_filename) ||\n> +\t\t\tdie \"Failed to open $compose_filename: $!\";\n> +\t\tif (grep(/^Subject:\\s*$/i, <C>)) {\n> +\t\t\tmy $r = ask(\"No Subject, send anyway? \".\n> +\t\t\t            \"([y]es|[n]o|[e]dit again): \",\n> +\t\t\t            valid_re => qr/^[yne]/i,\n> +\t\t\t            default => \"n\");\n> +\t\t\t$re_edit = lc(substr($r, 0, 1)) eq \"e\";\n> +\t\t\texit(0) if lc(substr($r, 0, 1)) eq \"n\";\n> +\t\t}\n> +\t\tclose C;\n> +\t} while ($re_edit);\n>  \n>  \topen(C2,\">\",$compose_filename . \".final\")\n>  \t\tor die \"Failed to open $compose_filename.final : \" . $!;\n> -- \n> 1.6.4\n"}]}