[PATCH] mailinfo: better parse email adresses containg parentheses

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

 



    When using git-rebase, author fields containing a ')' at the last
    position had the close-parens character incorrectly removed
    because the From: parser incorrectly matched it as

        user@host (User Name)

    (removing parentheses), instead of

        User Name (me) <user@host>

Signed-off-by: Philippe Bruhat (BooK) <book@xxxxxxxx>
---
 builtin-mailinfo.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/builtin-mailinfo.c b/builtin-mailinfo.c
index b99a5b6..5581c9f 100644
--- a/builtin-mailinfo.c
+++ b/builtin-mailinfo.c
@@ -115,10 +115,10 @@ static void handle_from(const struct strbuf *from)
 	 * the () pair at the end.
 	 */
 	strbuf_trim(&f);
-	if (f.buf[0] == '(')
+	if (f.buf[0] == '(' && f.len && f.buf[f.len - 1] == ')') {
 		strbuf_remove(&name, 0, 1);
-	if (f.len && f.buf[f.len - 1] == ')')
 		strbuf_setlen(&f, f.len - 1);
+	}
 
 	get_sane_name(&name, &f, &email);
 	strbuf_release(&f);
-- 
1.5.4.3

--
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