diff options
author | Junio C Hamano <junkio@cox.net> | 2005-12-14 17:30:03 -0800 |
---|---|---|
committer | Junio C Hamano <junkio@cox.net> | 2005-12-14 17:30:03 -0800 |
commit | 1ed91937e5cd59fdbdfa5f15f6fac132d2b21ce0 (patch) | |
tree | f65b929c006c31043213152752ea0c80bf08b9e5 /mailinfo.c | |
parent | GIT 0.99.9m aka 1.0rc5 (diff) | |
parent | git rebase loses author name/email if given bad email address (diff) | |
download | tgif-1ed91937e5cd59fdbdfa5f15f6fac132d2b21ce0.tar.xz |
GIT 0.99.9n aka 1.0rc6
Oh, I hate to do this but I ended up merging big usage string
cleanups from Fredrik, git-am enhancements that made a lot of
sense for non mbox users from HPA, and rebase changes (done
independently by me and Lukas) among other things, so git is
still in perpetual state of 1.0rc. 1.0 will probably be next
Wednesday, but who knows.
Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'mailinfo.c')
-rw-r--r-- | mailinfo.c | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/mailinfo.c b/mailinfo.c index d4b4163628..9f95f37651 100644 --- a/mailinfo.c +++ b/mailinfo.c @@ -40,13 +40,43 @@ static char *sanity_check(char *name, char *email) return name; } +static int bogus_from(char *line) +{ + /* John Doe <johndoe> */ + char *bra, *ket, *dst, *cp; + + /* This is fallback, so do not bother if we already have an + * e-mail address. + */ + if (*email) + return 0; + + bra = strchr(line, '<'); + if (!bra) + return 0; + ket = strchr(bra, '>'); + if (!ket) + return 0; + + for (dst = email, cp = bra+1; cp < ket; ) + *dst++ = *cp++; + *dst = 0; + for (cp = line; isspace(*cp); cp++) + ; + for (bra--; isspace(*bra); bra--) + *bra = 0; + cp = sanity_check(cp, email); + strcpy(name, cp); + return 1; +} + static int handle_from(char *line) { char *at = strchr(line, '@'); char *dst; if (!at) - return 0; + return bogus_from(line); /* * If we already have one email, don't take any confusing lines |