# [PATCH] git-send-email.perl: Add angle brackets to In-Reply-To if necessary

2 messages from 2007-08-12 to 2007-08-12. Participants: David Kastrup, Uwe Kleine-König.
Thread: https://gitlist.dev/t/9500

## David Kastrup, 2007-08-12 08:02

Subject: [PATCH] git-send-email.perl: Add angle brackets to In-Reply-To if necessary
Message-ID: <85lkchqixk.fsf@lola.goethe.zz>
URL: https://gitlist.dev/e/85lkchqixk.fsf%40lola.goethe.zz

```

Signed-off-by: David Kastrup <dak@gnu.org>
---
I have not actually tested this, but from staring at it intensively,
it should be correct.  One of the things that bit me when I tried
using this program.

 git-send-email.perl |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/git-send-email.perl b/git-send-email.perl
index 69559b2..877f74c 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -309,7 +309,8 @@ if ($thread && !defined $initial_reply_to && $prompting) {
 	} while (!defined $_);
 
 	$initial_reply_to = $_;
-	$initial_reply_to =~ s/(^\s+|\s+$)//g;
+	$initial_reply_to =~ s/^\s+<?/</;
+	$initial_reply_to =~ s/>?\s+$/>/;
 }
 
 if (!$smtp_server) {
-- 
1.5.3.rc2.187.g9a1d2-dirty

```

## Uwe Kleine-König, 2007-08-12 12:49

Subject: Re: [PATCH] git-send-email.perl: Add angle brackets to In-Reply-To if necessary
Message-ID: <20070812124901.GA9662@informatik.uni-freiburg.de>
URL: https://gitlist.dev/e/20070812124901.GA9662%40informatik.uni-freiburg.de
In-Reply-To: <85lkchqixk.fsf@lola.goethe.zz>

```
Hello David,

> I have not actually tested this, but from staring at it intensively,
> it should be correct.  One of the things that bit me when I tried
> using this program.
> 
> ...
> -	$initial_reply_to =~ s/(^\s+|\s+$)//g;
> +	$initial_reply_to =~ s/^\s+<?/</;
> +	$initial_reply_to =~ s/>?\s+$/>/;
> ...

some rules from rfc822:

	optional-field	= ... / "In-Reply-To:"  *(phrase / msg-id) / ...
	msg-id		= "<" addr-spec ">"
	phrase		= 1*word
	word		= atom / quoted-string
	atom		= 1*<any CHAR except specials, SPACE and CTLs>
	quoted-string	= <"> *(qtext/quoted-pair) <">
	...

With 1*... meaning "one or more" and *... meaning "zero or more".

That is not all fields of In-Reply-To: must be enclosed in '<', '>'.  I
didn't know that before looking it up and I expect it's not very common.
Even if no "phrase" is used there can be multiple msg-id's and then your
patch doesn't do the right thing.

But anyhow I think it's bearable to include these angle brackets in the
cut-and-paste process.

Best regards
Uwe

-- 
Uwe Kleine-König

http://www.google.com/search?q=1+electron+mass%3D

```
