]> gitweb.ps.run Git - ps-cgit/blobdiff - cgit.c
Merge branch 'stable'
[ps-cgit] / cgit.c
diff --git a/cgit.c b/cgit.c
index 2364d1c99e87de0a02d2c59927424ee55588871c..d6146e2270737806513b0ceca0e187475f93c121 100644 (file)
--- a/cgit.c
+++ b/cgit.c
@@ -1,6 +1,7 @@
 /* cgit.c: cgi for the git scm
  *
  * Copyright (C) 2006 Lars Hjemli
+ * Copyright (C) 2010 Jason A. Donenfeld <Jason@zx2c4.com>
  *
  * Licensed under GNU General Public License v2
  *   (see COPYING for full license text)
@@ -21,7 +22,7 @@ void add_mimetype(const char *name, const char *value)
 {
        struct string_list_item *item;
 
-       item = string_list_insert(xstrdup(name), &ctx.cfg.mimetypes);
+       item = string_list_insert(&ctx.cfg.mimetypes, xstrdup(name));
        item->util = xstrdup(value);
 }
 
@@ -71,7 +72,8 @@ void repo_config(struct cgit_repo *repo, const char *name, const char *value)
        else if (!strcmp(name, "section"))
                repo->section = xstrdup(value);
        else if (!strcmp(name, "readme") && value != NULL) {
-               if (*value == '/')
+               char *colon;
+               if (*value == '/' || ((colon = strchr(value, ':')) != NULL && colon != value && *(colon + 1) != '\0'))
                        repo->readme = xstrdup(value);
                else
                        repo->readme = xstrdup(fmt("%s/%s", repo->path, value));
@@ -135,6 +137,8 @@ void config_cb(const char *name, const char *value)
                ctx.cfg.snapshots = cgit_parse_snapshots_mask(value);
        else if (!strcmp(name, "enable-filter-overrides"))
                ctx.cfg.enable_filter_overrides = atoi(value);
+       else if (!strcmp(name, "enable-gitweb-owner"))
+               ctx.cfg.enable_gitweb_owner = atoi(value);
        else if (!strcmp(name, "enable-index-links"))
                ctx.cfg.enable_index_links = atoi(value);
        else if (!strcmp(name, "enable-log-filecount"))
@@ -205,6 +209,8 @@ void config_cb(const char *name, const char *value)
                ctx.cfg.agefile = xstrdup(value);
        else if (!strcmp(name, "renamelimit"))
                ctx.cfg.renamelimit = atoi(value);
+       else if (!strcmp(name, "remove-suffix"))
+               ctx.cfg.remove_suffix = atoi(value);
        else if (!strcmp(name, "robots"))
                ctx.cfg.robots = xstrdup(value);
        else if (!strcmp(name, "clone-prefix"))
@@ -291,6 +297,7 @@ static void prepare_context(struct cgit_context *ctx)
        ctx->cfg.css = "/cgit.css";
        ctx->cfg.logo = "/cgit.png";
        ctx->cfg.local_time = 0;
+       ctx->cfg.enable_gitweb_owner = 1;
        ctx->cfg.enable_tree_linenumbers = 1;
        ctx->cfg.max_repo_count = 50;
        ctx->cfg.max_commit_count = 50;
@@ -302,6 +309,7 @@ static void prepare_context(struct cgit_context *ctx)
        ctx->cfg.module_link = "./?repo=%s&page=commit&id=%s";
        ctx->cfg.project_list = NULL;
        ctx->cfg.renamelimit = -1;
+       ctx->cfg.remove_suffix = 0;
        ctx->cfg.robots = "index, nofollow";
        ctx->cfg.root_title = "Git repository browser";
        ctx->cfg.root_desc = "a fast webinterface for the git dscm";