Re: email address handling

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

On Fri, 1 Aug 2008, Andrew Morton wrote:

> I very very frequently copy and paste name+email address out of git 
> output and into an MUA.  Have done it thousands and thousands of times, 
> and it has always worked.  I'm sure that many others do the same thing.

$ git log --pretty=email

after this patch:

-- snipsnap --

 pretty.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/pretty.c b/pretty.c
index 33ef34a..ba50b54 100644
--- a/pretty.c
+++ b/pretty.c
@@ -140,14 +140,20 @@ void pp_user_info(const char *what, enum cmit_fmt fmt, struct strbuf *sb,
 	if (fmt == CMIT_FMT_EMAIL) {
 		char *name_tail = strchr(line, '<');
 		int display_name_length;
+		int need_quotes;
 		if (!name_tail)
 			return;
 		while (line < name_tail && isspace(name_tail[-1]))
 			name_tail--;
 		display_name_length = name_tail - line;
+		need_quotes = !!memchr(line, ',', display_name_length);
 		filler = "";
 		strbuf_addstr(sb, "From: ");
+		if (need_quotes)
+			strbuf_addch(sb, '"');
 		add_rfc2047(sb, line, display_name_length, encoding);
+		if (need_quotes)
+			strbuf_addch(sb, '"');
 		strbuf_add(sb, name_tail, namelen - display_name_length);
 		strbuf_addch(sb, '\n');
 	} else {
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux