]> gitweb.ps.run Git - ps-cgit/blobdiff - shared.c
Add cgit_diff_link()
[ps-cgit] / shared.c
index 65af11a05ac6433189f1da6f40a4bbf6fa96cfda..f20fb5cc423f5ab184a730a2f5e2c1bb5b4b066a 100644 (file)
--- a/shared.c
+++ b/shared.c
@@ -18,6 +18,7 @@ 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";
@@ -33,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;
@@ -57,7 +59,8 @@ int htmlfd = 0;
 
 int cgit_get_cmd_index(const char *cmd)
 {
-       static char *cmds[] = {"log", "commit", "diff", "tree", "view", "blob", "snapshot", NULL};
+       static char *cmds[] = {"log", "commit", "diff", "tree", "blob",
+                              "snapshot", NULL};
        int i;
 
        for(i = 0; cmds[i]; i++)
@@ -106,6 +109,7 @@ struct repoinfo *add_repo(const char *url)
        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;
 }
 
@@ -162,6 +166,10 @@ 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"))
@@ -184,7 +192,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);
 }
 
@@ -347,7 +360,7 @@ void cgit_diff_tree(const unsigned char *old_sha1,
        opt.format_callback_data = fn;
        diff_setup_done(&opt);
 
-       if (old_sha1)
+       if (old_sha1 && !is_null_sha1(old_sha1))
                ret = diff_tree_sha1(old_sha1, new_sha1, "", &opt);
        else
                ret = diff_root_tree_sha1(new_sha1, "", &opt);