]> git.cameronkatri.com Git - cgit.git/blobdiff - shared.c
Rename dirlink to gitlink.
[cgit.git] / shared.c
index fb0542705f78fba01cc06fc8a9feb3d2f644051b..b6d2fa1efe6a47f93054d6a6af29c3b4a5dbbb03 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_agefile      = "info/web/last-modified";
 char *cgit_virtual_root = NULL;
 char *cgit_script_name  = CGIT_SCRIPT_NAME;
 char *cgit_cache_root   = "/var/cache/cgit";
+char *cgit_repo_group   = NULL;
 
 int cgit_nocache               =  0;
 int cgit_snapshots             =  0;
@@ -30,6 +34,7 @@ int cgit_cache_repo_ttl        =  5;
 int cgit_cache_dynamic_ttl     =  5;
 int cgit_cache_static_ttl      = -1;
 int cgit_cache_max_create_time =  5;
+int cgit_summary_log           =  0;
 
 int cgit_max_msg_len = 60;
 int cgit_max_repodesc_len = 60;
@@ -97,11 +102,13 @@ struct repoinfo *add_repo(const char *url)
        ret->path = NULL;
        ret->desc = NULL;
        ret->owner = NULL;
+       ret->group = cgit_repo_group;
        ret->defbranch = "master";
        ret->snapshots = cgit_snapshots;
        ret->enable_log_filecount = cgit_enable_log_filecount;
        ret->enable_log_linecount = cgit_enable_log_linecount;
        ret->module_link = cgit_module_link;
+       ret->readme = NULL;
        return ret;
 }
 
@@ -126,6 +133,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"))
@@ -156,6 +165,12 @@ void cgit_global_config_cb(const char *name, const char *value)
                cgit_max_repodesc_len = atoi(value);
        else if (!strcmp(name, "max-commit-count"))
                cgit_max_commit_count = atoi(value);
+       else if (!strcmp(name, "summary-log"))
+               cgit_summary_log = atoi(value);
+       else if (!strcmp(name, "agefile"))
+               cgit_agefile = xstrdup(value);
+       else if (!strcmp(name, "repo.group"))
+               cgit_repo_group = xstrdup(value);
        else if (!strcmp(name, "repo.url"))
                cgit_repo = add_repo(value);
        else if (!strcmp(name, "repo.name"))
@@ -176,7 +191,12 @@ void cgit_global_config_cb(const char *name, const char *value)
                cgit_repo->enable_log_linecount = cgit_enable_log_linecount * atoi(value);
        else if (cgit_repo && !strcmp(name, "repo.module-link"))
                cgit_repo->module_link= xstrdup(value);
-       else if (!strcmp(name, "include"))
+       else if (cgit_repo && !strcmp(name, "repo.readme") && value != NULL) {
+               if (*value == '/')
+                       cgit_repo->readme = xstrdup(value);
+               else
+                       cgit_repo->readme = xstrdup(fmt("%s/%s", cgit_repo->path, value));
+       } else if (!strcmp(name, "include"))
                cgit_read_config(value, cgit_global_config_cb);
 }
 
@@ -184,8 +204,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")) {