From e27ddb64568412b75035a05366c9f091153155ed Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Fri, 31 Aug 2012 14:54:18 -0700 Subject: split_ident_line(): make best effort when parsing author/committer line Commits made by ancient version of Git allowed committer without human readable name, like this (00213b17c in the kernel history): tree 6947dba41f8b0e7fe7bccd41a4840d6de6a27079 parent 352dd1df32e672be4cff71132eb9c06a257872fe author Petr Baudis 1135223044 +0100 committer 1136151043 +0100 kconfig: Remove support for lxdialog --checklist ... Signed-off-by: Petr Baudis Signed-off-by: Sam Ravnborg When fed such a commit, --format='%ci' fails to parse it, and gives back an empty string. Update the split_ident_line() to be a bit more lenient when parsing, but make sure the caller that wants to pick up sane value from its return value does its own validation. Signed-off-by: Junio C Hamano --- ident.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'ident.c') diff --git a/ident.c b/ident.c index 443c0751b..484e0a980 100644 --- a/ident.c +++ b/ident.c @@ -210,8 +210,10 @@ int split_ident_line(struct ident_split *split, const char *line, int len) split->name_end = cp + 1; break; } - if (!split->name_end) - return status; + if (!split->name_end) { + /* no human readable name */ + split->name_end = split->name_begin; + } for (cp = split->mail_begin; cp < line + len; cp++) if (*cp == '>') { -- cgit v1.2.1