From: Jonas Fonseca Date: Sat, 17 Jan 2009 07:31:57 +0000 (+0100) Subject: Improve messages when preparing to load blame commits X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=c6482888e3c06f6291ee5778c19d187a2503b23c;p=tig.git Improve messages when preparing to load blame commits --- diff --git a/tig.c b/tig.c index d5c8a24..d812fa3 100644 --- a/tig.c +++ b/tig.c @@ -4038,6 +4038,18 @@ blame_draw(struct view *view, struct line *line, unsigned int lineno) return TRUE; } +static bool +check_blame_commit(struct blame *blame) +{ + if (!blame->commit) + report("Commit data not loaded yet"); + else if (!strcmp(blame->commit->id, NULL_ID)) + report("No commit exist for the selected line"); + else + return TRUE; + return FALSE; +} + static enum request blame_request(struct view *view, enum request request, struct line *line) { @@ -4046,13 +4058,11 @@ blame_request(struct view *view, enum request request, struct line *line) switch (request) { case REQ_VIEW_BLAME: - if (!blame->commit || !strcmp(blame->commit->id, NULL_ID)) { - report("Commit ID unknown"); - break; + if (check_blame_commit(blame)) { + string_copy(opt_ref, blame->commit->id); + open_view(view, REQ_VIEW_BLAME, OPEN_REFRESH); } - string_copy(opt_ref, blame->commit->id); - open_view(view, REQ_VIEW_BLAME, OPEN_REFRESH); - return request; + break; case REQ_ENTER: if (!blame->commit) {