From 9073c64a86cf644d1c2563d610449da690d1533d Mon Sep 17 00:00:00 2001 From: Jonas Fonseca Date: Sun, 29 Oct 2006 15:21:13 +0100 Subject: [PATCH] main_read: handle titles that start with whitespace --- tig.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/tig.c b/tig.c index 5255e14..b864e0b 100644 --- a/tig.c +++ b/tig.c @@ -2887,13 +2887,19 @@ main_read(struct view *view, char *line) /* Require titles to start with a non-space character at the * offset used by git log. */ - /* FIXME: More gracefull handling of titles; append "..." to - * shortened titles, etc. */ - if (strncmp(line, " ", 4) || - isspace(line[4])) + if (strncmp(line, " ", 4)) + break; + line += 4; + /* Well, if the title starts with a whitespace character, + * try to be forgiving. Otherwise we end up with no title. */ + while (isspace(*line)) + line++; + if (*line == '\0') break; + /* FIXME: More graceful handling of titles; append "..." to + * shortened titles, etc. */ - string_copy(commit->title, line + 4); + string_copy(commit->title, line); } return TRUE; -- 2.11.0