Code

Error out when starting up in empty main or blame view
authorJonas Fonseca <fonseca@diku.dk>
Thu, 3 Apr 2008 23:43:26 +0000 (01:43 +0200)
committerJonas Fonseca <fonseca@diku.dk>
Thu, 3 Apr 2008 23:43:26 +0000 (01:43 +0200)
This usually means that the arguments did not match any revisions or file.

tig.c

diff --git a/tig.c b/tig.c
index 7ca509c369a846009627576e5d847b678e47e865..04c607f12f1d11bda63f8890de9c440abbd447f8 100644 (file)
--- a/tig.c
+++ b/tig.c
@@ -3488,6 +3488,8 @@ blame_read_file(struct view *view, char *line)
 
                if (view->lines > 0)
                        pipe = popen(view->cmd, "r");
+               else if (!view->parent)
+                       die("No blame exist for %s", view->vid);
                view->cmd[0] = 0;
                if (!pipe) {
                        report("Failed to load blame data");
@@ -4947,6 +4949,8 @@ main_read(struct view *view, char *line)
        struct commit *commit;
 
        if (!line) {
+               if (!view->lines && !view->parent)
+                       die("No revisions match the given arguments.");
                update_rev_graph(graph);
                return TRUE;
        }