Code

Move git directory assertion to main; don't require .git repo in pager mode
authorJonas Fonseca <fonseca@diku.dk>
Sat, 20 May 2006 19:07:44 +0000 (21:07 +0200)
committerJonas Fonseca <fonseca@antimatter.localdomain>
Sat, 20 May 2006 19:07:44 +0000 (21:07 +0200)
tig.c

diff --git a/tig.c b/tig.c
index 3c267aff669f9a1fad1d45ecbe0169d893d3f0c9..be165b9598f5be6f5c20249a154d4393987e6087 100644 (file)
--- a/tig.c
+++ b/tig.c
@@ -2297,9 +2297,6 @@ load_refs(void)
 
        pclose(pipe);
 
-       if (refs_size == 0)
-               die("Not a git repository");
-
        return OK;
 }
 
@@ -2353,6 +2350,10 @@ main(int argc, char *argv[])
        if (load_refs() == ERR)
                die("Failed to load refs.");
 
+       /* Require a git repository unless when running in pager mode. */
+       if (refs_size == 0 && opt_request != REQ_VIEW_PAGER)
+               die("Not a git repository");
+
        for (i = 0; i < ARRAY_SIZE(views) && (view = &views[i]); i++)
                view->cmd_env = getenv(view->cmd_env);