summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 85f9b52)
raw | patch | inline | side by side (parent: 85f9b52)
author | Jonas Fonseca <fonseca@diku.dk> | |
Sat, 17 Jan 2009 07:31:57 +0000 (08:31 +0100) | ||
committer | Jonas Fonseca <fonseca@diku.dk> | |
Sat, 17 Jan 2009 07:49:02 +0000 (08:49 +0100) |
tig.c | patch | blob | history |
index d5c8a245693eea7c7cdbd62489f0321b866a8c68..d812fa395cd8b13487099ec0667ad4e192f008f1 100644 (file)
--- a/tig.c
+++ b/tig.c
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)
{
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) {