]> gitweb.ps.run Git - ps-cgit/blobdiff - shared.c
cgit v0.6.3
[ps-cgit] / shared.c
index ccbde27af849f257ff7bdaa166297c01e49e4efc..0fe513f4f24efc7796d3627e7743e952e323ed35 100644 (file)
--- a/shared.c
+++ b/shared.c
@@ -23,7 +23,7 @@ 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_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_cache_root   = CGIT_CACHE_ROOT;
 char *cgit_repo_group   = NULL;
 
 int cgit_nocache               =  0;
 char *cgit_repo_group   = NULL;
 
 int cgit_nocache               =  0;
@@ -63,7 +63,7 @@ int htmlfd = 0;
 int cgit_get_cmd_index(const char *cmd)
 {
        static char *cmds[] = {"log", "commit", "diff", "tree", "blob",
 int cgit_get_cmd_index(const char *cmd)
 {
        static char *cmds[] = {"log", "commit", "diff", "tree", "blob",
-                              "snapshot", NULL};
+                              "snapshot", "tag", NULL};
        int i;
 
        for(i = 0; cmds[i]; i++)
        int i;
 
        for(i = 0; cmds[i]; i++)
@@ -108,7 +108,7 @@ struct repoinfo *add_repo(const char *url)
        }
 
        ret = &cgit_repolist.repos[cgit_repolist.count-1];
        }
 
        ret = &cgit_repolist.repos[cgit_repolist.count-1];
-       ret->url = xstrdup(url);
+       ret->url = trim_end(url, '/');
        ret->name = ret->url;
        ret->path = NULL;
        ret->desc = NULL;
        ret->name = ret->url;
        ret->path = NULL;
        ret->desc = NULL;
@@ -151,7 +151,7 @@ void cgit_global_config_cb(const char *name, const char *value)
        else if (!strcmp(name, "module-link"))
                cgit_module_link = xstrdup(value);
        else if (!strcmp(name, "virtual-root"))
        else if (!strcmp(name, "module-link"))
                cgit_module_link = xstrdup(value);
        else if (!strcmp(name, "virtual-root"))
-               cgit_virtual_root = xstrdup(value);
+               cgit_virtual_root = trim_end(value, '/');
        else if (!strcmp(name, "nocache"))
                cgit_nocache = atoi(value);
        else if (!strcmp(name, "snapshots"))
        else if (!strcmp(name, "nocache"))
                cgit_nocache = atoi(value);
        else if (!strcmp(name, "snapshots"))
@@ -189,7 +189,7 @@ void cgit_global_config_cb(const char *name, const char *value)
        else if (!strcmp(name, "repo.name"))
                cgit_repo->name = xstrdup(value);
        else if (cgit_repo && !strcmp(name, "repo.path"))
        else if (!strcmp(name, "repo.name"))
                cgit_repo->name = xstrdup(value);
        else if (cgit_repo && !strcmp(name, "repo.path"))
-               cgit_repo->path = xstrdup(value);
+               cgit_repo->path = trim_end(value, '/');
        else if (cgit_repo && !strcmp(name, "repo.desc"))
                cgit_repo->desc = xstrdup(value);
        else if (cgit_repo && !strcmp(name, "repo.owner"))
        else if (cgit_repo && !strcmp(name, "repo.desc"))
                cgit_repo->desc = xstrdup(value);
        else if (cgit_repo && !strcmp(name, "repo.owner"))
@@ -308,7 +308,8 @@ static int load_mmfile(mmfile_t *file, const unsigned char *sha1)
                file->ptr = (char *)"";
                file->size = 0;
        } else {
                file->ptr = (char *)"";
                file->size = 0;
        } else {
-               file->ptr = read_sha1_file(sha1, &type, &file->size);
+               file->ptr = read_sha1_file(sha1, &type, 
+                                          (unsigned long *)&file->size);
        }
        return 1;
 }
        }
        return 1;
 }
@@ -373,6 +374,7 @@ int cgit_diff_files(const unsigned char *old_sha1,
        diff_params.flags = XDF_NEED_MINIMAL;
        emit_params.ctxlen = 3;
        emit_params.flags = XDL_EMIT_FUNCNAMES;
        diff_params.flags = XDF_NEED_MINIMAL;
        emit_params.ctxlen = 3;
        emit_params.flags = XDL_EMIT_FUNCNAMES;
+       emit_params.find_func = NULL;
        emit_cb.outf = filediff_cb;
        emit_cb.priv = fn;
        xdl_diff(&file1, &file2, &diff_params, &emit_params, &emit_cb);
        emit_cb.outf = filediff_cb;
        emit_cb.priv = fn;
        xdl_diff(&file1, &file2, &diff_params, &emit_params, &emit_cb);