]> git.cameronkatri.com Git - cgit.git/blobdiff - shared.c
Merge branch 'virtual-url'
[cgit.git] / shared.c
index b164d8132ab1399d8a1c51c44e386305343a5fec..45fde7fe3bc23fd8d7e9bbf6861f70395330df25 100644 (file)
--- a/shared.c
+++ b/shared.c
 
 struct repolist cgit_repolist;
 struct repoinfo *cgit_repo;
+int cgit_cmd;
 
 char *cgit_root_title   = "Git repository browser";
 char *cgit_css          = "/cgit.css";
 char *cgit_logo         = "/git-logo.png";
+char *cgit_index_header = NULL;
 char *cgit_logo_link    = "http://www.kernel.org/pub/software/scm/git/docs/";
 char *cgit_module_link  = "./?repo=%s&page=commit&id=%s";
 char *cgit_virtual_root = NULL;
@@ -51,6 +53,18 @@ int   cgit_query_ofs    = 0;
 
 int htmlfd = 0;
 
+
+int cgit_get_cmd_index(const char *cmd)
+{
+       static char *cmds[] = {"log", "commit", "diff", "tree", "view", "blob", "snapshot", NULL};
+       int i;
+
+       for(i = 0; cmds[i]; i++)
+               if (!strcmp(cmd, cmds[i]))
+                       return i + 1;
+       return 0;
+}
+
 int chk_zero(int result, char *msg)
 {
        if (result != 0)
@@ -114,6 +128,8 @@ void cgit_global_config_cb(const char *name, const char *value)
                cgit_css = xstrdup(value);
        else if (!strcmp(name, "logo"))
                cgit_logo = xstrdup(value);
+       else if (!strcmp(name, "index-header"))
+               cgit_index_header = xstrdup(value);
        else if (!strcmp(name, "logo-link"))
                cgit_logo_link = xstrdup(value);
        else if (!strcmp(name, "module-link"))
@@ -172,8 +188,12 @@ void cgit_querystring_cb(const char *name, const char *value)
 {
        if (!strcmp(name,"r")) {
                cgit_query_repo = xstrdup(value);
+               cgit_repo = cgit_get_repoinfo(value);
        } else if (!strcmp(name, "p")) {
                cgit_query_page = xstrdup(value);
+               cgit_cmd = cgit_get_cmd_index(value);
+       } else if (!strcmp(name, "url")) {
+               cgit_parse_url(value);
        } else if (!strcmp(name, "q")) {
                cgit_query_search = xstrdup(value);
        } else if (!strcmp(name, "h")) {