From cbbf2d1be57f0bbd9eda37f3d5ab7e30d3ae179b Mon Sep 17 00:00:00 2001 From: Jonas Fonseca Date: Wed, 23 Aug 2006 00:05:06 +0200 Subject: [PATCH] Improve handling of 'bogus' author lines If no author name is in the ident line fall-back to use the author email. Set to "Unknown" if neither is found. --- tig.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tig.c b/tig.c index 6a1f3d1..f110dae 100644 --- a/tig.c +++ b/tig.c @@ -2286,10 +2286,22 @@ main_read(struct view *view, char *line) break; if (end) { + char *email = end + 1; + for (; end > ident && isspace(end[-1]); end--) ; + + if (end == ident && *email) { + ident = email; + end = strchr(ident, '>'); + for (; end > ident && isspace(end[-1]); end--) ; + } *end = 0; } + /* End is NULL or ident meaning there's no author. */ + if (end <= ident) + ident = "Unknown"; + string_copy(commit->author, ident); /* Parse epoch and timezone */ -- 2.32.0.93.g670b81a890