{"thread":{"id":"31388","subject":"[PATCH v2] Thunderbird: fix appp.sh format problems","startedAt":"2012-08-30T08:48:14Z","lastAt":"2012-08-31T07:09:28Z","messageCount":3,"participants":["Marco Stornelli","Junio C Hamano"],"isPatch":true,"patchVersion":2,"patchTotal":null},"messages":[{"id":"198089","messageId":"503F28CE.2090400@gmail.com","threadId":"31388","inReplyTo":null,"subject":"[PATCH v2] Thunderbird: fix appp.sh format problems","fromName":"Marco Stornelli","fromEmail":"marco.stornelli@gmail.com","sentAt":"2012-08-30T08:48:14Z","receivedAt":"2012-08-30T08:48:14Z","isPatch":true,"sender":{"key":"marco.stornelli@gmail.com","avatar":null},"body":"The current script has got the following problems:\n\n1) It doesn't work if the language used by Thunderbird is not English;\n2) The field To: filled by format-patch is not evaluated;\n3) The field Cc: is loaded only from Cc used in the commit message\ninstead of using even the Cc field filled by format-patch in the email\nheader.\n\nAdded comments for point 1). Fixed point 2) and 3).\n\nSigned-off-by: Marco Stornelli <marco.stornelli@gmail.com>\n---\nv2: changed the commit message to reflect better the script implementation\n\n contrib/thunderbird-patch-inline/appp.sh |   18 ++++++++++++++----\n 1 files changed, 14 insertions(+), 4 deletions(-)\n\ndiff --git a/contrib/thunderbird-patch-inline/appp.sh b/contrib/thunderbird-patch-inline/appp.sh\nindex 5eb4a51..e6e1b85 100755\n--- a/contrib/thunderbird-patch-inline/appp.sh\n+++ b/contrib/thunderbird-patch-inline/appp.sh\n@@ -6,6 +6,9 @@\n \n # ExternalEditor can be downloaded at http://globs.org/articles.php?lng=en&pg=2\n \n+# NOTE: You must change some words in this script according to the language\n+# used by Mozilla Thunderbird, as <Subject>, <To>, <Don't remove this line>.\n+\n CONFFILE=~/.appprc\n \n SEP=\"-=-=-=-=-=-=-=-=-=# Don't remove this line #=-=-=-=-=-=-=-=-=-\"\n@@ -26,17 +29,24 @@ fi\n cd - > /dev/null\n \n SUBJECT=`sed -n -e '/^Subject: /p' \"${PATCH}\"`\n-HEADERS=`sed -e '/^'\"${SEP}\"'$/,$d' $1`\n BODY=`sed -e \"1,/${SEP}/d\" $1`\n CMT_MSG=`sed -e '1,/^$/d' -e '/^---$/,$d' \"${PATCH}\"`\n DIFF=`sed -e '1,/^---$/d' \"${PATCH}\"`\n \n-CCS=`echo -e \"$CMT_MSG\\n$HEADERS\" | sed -n -e 's/^Cc: \\(.*\\)$/\\1,/gp' \\\n-\t-e 's/^Signed-off-by: \\(.*\\)/\\1,/gp'`\n+export PATCH\n+CCS=`perl -e 'local $/=undef; open FILE, $ENV{'PATCH'}; $text=<FILE>;\n+close FILE; $cc = $1 if $text =~ /Cc: (.*?(,\\n .*?)*)\\n/s; $cc =~ s/\\n//g;\n+print $cc;'`\n+\n+TO=`perl -e 'local $/=undef; open FILE, $ENV{'PATCH'}; $text=<FILE>;\n+close FILE; $to = $1 if $text =~ /To: (.*?(,\\n .*?)*)\\n/s; $to =~ s/\\n//g;\n+print $to;'`\n \n+# Change <Subject> before next line according to Thunderbird language\n echo \"$SUBJECT\" > $1\n+# Change <To> according to Thunderbird language\n+echo \"To: $TO\" >> $1\n echo \"Cc: $CCS\" >> $1\n-echo \"$HEADERS\" | sed -e '/^Subject: /d' -e '/^Cc: /d' >> $1\n echo \"$SEP\" >> $1\n \n echo \"$CMT_MSG\" >> $1\n-- \n1.7.3.4\n"},{"id":"198109","messageId":"7vtxvks4aj.fsf@alter.siamese.dyndns.org","threadId":"31388","inReplyTo":"503F28CE.2090400@gmail.com","subject":"Re: [PATCH v2] Thunderbird: fix appp.sh format problems","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-08-30T17:00:52Z","receivedAt":"2012-08-30T17:00:52Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Marco Stornelli <marco.stornelli@gmail.com> writes:\n\n> The current script has got the following problems:\n>\n> 1) It doesn't work if the language used by Thunderbird is not English;\n> 2) The field To: filled by format-patch is not evaluated;\n> 3) The field Cc: is loaded only from Cc used in the commit message\n> instead of using even the Cc field filled by format-patch in the email\n> header.\n>\n> Added comments for point 1). Fixed point 2) and 3).\n>\n> Signed-off-by: Marco Stornelli <marco.stornelli@gmail.com>\n> ---\n> v2: changed the commit message to reflect better the script implementation\n\nI actually thought what the log message of the previous version\nclaimed to do was much more sensible.\n\nThe language used in the above 3 items describe what you perceive as\na problem, but it is unclear what the desired behaviour that is\ndifferent from the current one is.  (2) \"... is not evaluated\"\nimplies \", which is a problem, so fix it by evaluating it\", but\nthere is no single obvious fix to (3) \"loaded only from Cc in commit\nand not Cc from format-patch\".  Should it ignore Cc from commit log\nmessage, or should it take Cc from both log message and e-mail\nheader?  I personally think it should the former, but it is not\nclear which you think is the right thing to do (or perhaps you have\na third answer) if you only say \"Fixed point 3\".\n>\n>  contrib/thunderbird-patch-inline/appp.sh |   18 ++++++++++++++----\n>  1 files changed, 14 insertions(+), 4 deletions(-)\n>\n> diff --git a/contrib/thunderbird-patch-inline/appp.sh b/contrib/thunderbird-patch-inline/appp.sh\n> index 5eb4a51..e6e1b85 100755\n> --- a/contrib/thunderbird-patch-inline/appp.sh\n> +++ b/contrib/thunderbird-patch-inline/appp.sh\n> @@ -6,6 +6,9 @@\n>  \n>  # ExternalEditor can be downloaded at http://globs.org/articles.php?lng=en&pg=2\n>  \n> +# NOTE: You must change some words in this script according to the language\n> +# used by Mozilla Thunderbird, as <Subject>, <To>, <Don't remove this line>.\n> +\n>  CONFFILE=~/.appprc\n>  \n>  SEP=\"-=-=-=-=-=-=-=-=-=# Don't remove this line #=-=-=-=-=-=-=-=-=-\"\n> @@ -26,17 +29,24 @@ fi\n>  cd - > /dev/null\n>  \n>  SUBJECT=`sed -n -e '/^Subject: /p' \"${PATCH}\"`\n> -HEADERS=`sed -e '/^'\"${SEP}\"'$/,$d' $1`\n>  BODY=`sed -e \"1,/${SEP}/d\" $1`\n>  CMT_MSG=`sed -e '1,/^$/d' -e '/^---$/,$d' \"${PATCH}\"`\n>  DIFF=`sed -e '1,/^---$/d' \"${PATCH}\"`\n>  \n> -CCS=`echo -e \"$CMT_MSG\\n$HEADERS\" | sed -n -e 's/^Cc: \\(.*\\)$/\\1,/gp' \\\n> -\t-e 's/^Signed-off-by: \\(.*\\)/\\1,/gp'`\n> +export PATCH\n> +CCS=`perl -e 'local $/=undef; open FILE, $ENV{'PATCH'}; $text=<FILE>;\n> +close FILE; $cc = $1 if $text =~ /Cc: (.*?(,\\n .*?)*)\\n/s; $cc =~ s/\\n//g;\n> +print $cc;'`\n> +\n> +TO=`perl -e 'local $/=undef; open FILE, $ENV{'PATCH'}; $text=<FILE>;\n> +close FILE; $to = $1 if $text =~ /To: (.*?(,\\n .*?)*)\\n/s; $to =~ s/\\n//g;\n> +print $to;'`\n>  \n> +# Change <Subject> before next line according to Thunderbird language\n>  echo \"$SUBJECT\" > $1\n\n\"before next line\"???  I do not think you meant to rename the\nvariable $SUBJECT to $<localized string for subject>.\n\n> +# Change <To> according to Thunderbird language\n\n\t# Change \"To: \" according to...\n\nwould be less confusing, as the line has to \"to\" on it when viewed\ncase insensitively.\n\n> +echo \"To: $TO\" >> $1\n\n>  echo \"Cc: $CCS\" >> $1\n> -echo \"$HEADERS\" | sed -e '/^Subject: /d' -e '/^Cc: /d' >> $1\n>  echo \"$SEP\" >> $1\n>  \n>  echo \"$CMT_MSG\" >> $1\n"},{"id":"198140","messageId":"50406328.60003@gmail.com","threadId":"31388","inReplyTo":"7vtxvks4aj.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH v2] Thunderbird: fix appp.sh format problems","fromName":"Marco Stornelli","fromEmail":"marco.stornelli@gmail.com","sentAt":"2012-08-31T07:09:28Z","receivedAt":"2012-08-31T07:09:28Z","isPatch":true,"sender":{"key":"marco.stornelli@gmail.com","avatar":null},"body":"Il 30/08/2012 19:00, Junio C Hamano ha scritto:\n> Marco Stornelli <marco.stornelli@gmail.com> writes:\n>\n>> The current script has got the following problems:\n>>\n>> 1) It doesn't work if the language used by Thunderbird is not English;\n>> 2) The field To: filled by format-patch is not evaluated;\n>> 3) The field Cc: is loaded only from Cc used in the commit message\n>> instead of using even the Cc field filled by format-patch in the email\n>> header.\n>>\n>> Added comments for point 1). Fixed point 2) and 3).\n>>\n>> Signed-off-by: Marco Stornelli <marco.stornelli@gmail.com>\n>> ---\n>> v2: changed the commit message to reflect better the script implementation\n>\n> I actually thought what the log message of the previous version\n> claimed to do was much more sensible.\n>\n> The language used in the above 3 items describe what you perceive as\n> a problem, but it is unclear what the desired behaviour that is\n> different from the current one is.  (2) \"... is not evaluated\"\n> implies \", which is a problem, so fix it by evaluating it\", but\n> there is no single obvious fix to (3) \"loaded only from Cc in commit\n> and not Cc from format-patch\".  Should it ignore Cc from commit log\n> message, or should it take Cc from both log message and e-mail\n> header?  I personally think it should the former, but it is not\n> clear which you think is the right thing to do (or perhaps you have\n> a third answer) if you only say \"Fixed point 3\".\n\nOk, I can change the commit. Actually with the new implementation Cc: is \nevaluated in both cases.\n\n>>\n>>   contrib/thunderbird-patch-inline/appp.sh |   18 ++++++++++++++----\n>>   1 files changed, 14 insertions(+), 4 deletions(-)\n>>\n>> diff --git a/contrib/thunderbird-patch-inline/appp.sh b/contrib/thunderbird-patch-inline/appp.sh\n>> index 5eb4a51..e6e1b85 100755\n>> --- a/contrib/thunderbird-patch-inline/appp.sh\n>> +++ b/contrib/thunderbird-patch-inline/appp.sh\n>> @@ -6,6 +6,9 @@\n>>\n>>   # ExternalEditor can be downloaded at http://globs.org/articles.php?lng=en&pg=2\n>>\n>> +# NOTE: You must change some words in this script according to the language\n>> +# used by Mozilla Thunderbird, as <Subject>, <To>, <Don't remove this line>.\n>> +\n>>   CONFFILE=~/.appprc\n>>\n>>   SEP=\"-=-=-=-=-=-=-=-=-=# Don't remove this line #=-=-=-=-=-=-=-=-=-\"\n>> @@ -26,17 +29,24 @@ fi\n>>   cd - > /dev/null\n>>\n>>   SUBJECT=`sed -n -e '/^Subject: /p' \"${PATCH}\"`\n>> -HEADERS=`sed -e '/^'\"${SEP}\"'$/,$d' $1`\n>>   BODY=`sed -e \"1,/${SEP}/d\" $1`\n>>   CMT_MSG=`sed -e '1,/^$/d' -e '/^---$/,$d' \"${PATCH}\"`\n>>   DIFF=`sed -e '1,/^---$/d' \"${PATCH}\"`\n>>\n>> -CCS=`echo -e \"$CMT_MSG\\n$HEADERS\" | sed -n -e 's/^Cc: \\(.*\\)$/\\1,/gp' \\\n>> -\t-e 's/^Signed-off-by: \\(.*\\)/\\1,/gp'`\n>> +export PATCH\n>> +CCS=`perl -e 'local $/=undef; open FILE, $ENV{'PATCH'}; $text=<FILE>;\n>> +close FILE; $cc = $1 if $text =~ /Cc: (.*?(,\\n .*?)*)\\n/s; $cc =~ s/\\n//g;\n>> +print $cc;'`\n>> +\n>> +TO=`perl -e 'local $/=undef; open FILE, $ENV{'PATCH'}; $text=<FILE>;\n>> +close FILE; $to = $1 if $text =~ /To: (.*?(,\\n .*?)*)\\n/s; $to =~ s/\\n//g;\n>> +print $to;'`\n>>\n>> +# Change <Subject> before next line according to Thunderbird language\n>>   echo \"$SUBJECT\" > $1\n>\n> \"before next line\"???  I do not think you meant to rename the\n> variable $SUBJECT to $<localized string for subject>.\n\nIn my case I add a line before in this way:\n\n....\nSUBJECT=`echo $SUBJECT | sed 's/Subject/Oggetto/g'`\necho \"$SUBJECT\" > $1\n....\n\n>\n>> +# Change <To> according to Thunderbird language\n>\n> \t# Change \"To: \" according to...\n\nOk.\n\n>\n> would be less confusing, as the line has to \"to\" on it when viewed\n> case insensitively.\n>\n>> +echo \"To: $TO\" >> $1\n>\n>>   echo \"Cc: $CCS\" >> $1\n>> -echo \"$HEADERS\" | sed -e '/^Subject: /d' -e '/^Cc: /d' >> $1\n>>   echo \"$SEP\" >> $1\n>>\n>>   echo \"$CMT_MSG\" >> $1\n>\n"}]}