summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilippe Bruhat (BooK) <book@cpan.org>2008-07-21 13:34:29 (GMT)
committerJunio C Hamano <gitster@pobox.com>2008-07-22 03:09:12 (GMT)
commit0d4ede9f5493f0e15fb4f799e6a4a25e36c49fd2 (patch)
treed35c355043be527f84bde43990507a757ccf18a9
parent75e1645fbe5e0309fbab8c2bfeaebe2c505e679d (diff)
downloadgit-0d4ede9f5493f0e15fb4f799e6a4a25e36c49fd2.zip
git-0d4ede9f5493f0e15fb4f799e6a4a25e36c49fd2.tar.gz
git-0d4ede9f5493f0e15fb4f799e6a4a25e36c49fd2.tar.bz2
mailinfo: better parse email adresses containg parentheses
When using git-rebase, author fields containing a ')' at the last position had the close-parens character removed; the removal should be done only when it is of this form: user@host (User Name) i.e. the remainder after stripping the e-mail address part is enclosed in a parentheses pair as a whole, not for addresses like this: User Name (me) <user@host> Signed-off-by: Philippe Bruhat (BooK) <book@cpan.org> Acked-by: Lukas Sandström <lukass@etek.chalmers.se> Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r--builtin-mailinfo.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/builtin-mailinfo.c b/builtin-mailinfo.c
index b99a5b6..f974b9d 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] == '(')
- strbuf_remove(&name, 0, 1);
- if (f.len && f.buf[f.len - 1] == ')')
+ if (f.buf[0] == '(' && f.len && f.buf[f.len - 1] == ')') {
+ strbuf_remove(&f, 0, 1);
strbuf_setlen(&f, f.len - 1);
+ }
get_sane_name(&name, &f, &email);
strbuf_release(&f);