]> gitweb.ps.run Git - ps-cgit/commitdiff
Merge branch 'lh/remote-branches'
authorLars Hjemli <hjemli@gmail.com>
Tue, 8 Dec 2009 18:34:30 +0000 (19:34 +0100)
committerLars Hjemli <hjemli@gmail.com>
Tue, 8 Dec 2009 18:34:30 +0000 (19:34 +0100)
1  2 
cgit.c
cgit.h
cgitrc.5.txt
ui-refs.c

diff --combined cgit.c
index 4f68a4bbd7434f597aac6d6f8b3c59a11a371b47,29813cd5e534f09f064e2aee14f8c5e0351d1207..e46c00a48e9e97f78a38d41b87b1a98f088e941f
--- 1/cgit.c
--- 2/cgit.c
+++ b/cgit.c
@@@ -60,6 -60,8 +60,8 @@@ void repo_config(struct cgit_repo *repo
                repo->enable_log_filecount = ctx.cfg.enable_log_filecount * atoi(value);
        else if (!strcmp(name, "enable-log-linecount"))
                repo->enable_log_linecount = ctx.cfg.enable_log_linecount * atoi(value);
+       else if (!strcmp(name, "enable-remote-branches"))
+               repo->enable_remote_branches = atoi(value);
        else if (!strcmp(name, "max-stats"))
                repo->max_stats = cgit_find_stats_period(value, NULL);
        else if (!strcmp(name, "module-link"))
@@@ -68,9 -70,9 +70,9 @@@
                repo->section = xstrdup(value);
        else if (!strcmp(name, "readme") && value != NULL) {
                if (*value == '/')
 -                      ctx.repo->readme = xstrdup(value);
 +                      repo->readme = xstrdup(value);
                else
 -                      ctx.repo->readme = xstrdup(fmt("%s/%s", ctx.repo->path, value));
 +                      repo->readme = xstrdup(fmt("%s/%s", repo->path, value));
        } else if (ctx.cfg.enable_filter_overrides) {
                if (!strcmp(name, "about-filter"))
                        repo->about_filter = new_filter(value, 0);
@@@ -137,6 -139,8 +139,8 @@@ void config_cb(const char *name, const 
                ctx.cfg.enable_log_filecount = atoi(value);
        else if (!strcmp(name, "enable-log-linecount"))
                ctx.cfg.enable_log_linecount = atoi(value);
+       else if (!strcmp(name, "enable-remote-branches"))
+               ctx.cfg.enable_remote_branches = atoi(value);
        else if (!strcmp(name, "enable-tree-linenumbers"))
                ctx.cfg.enable_tree_linenumbers = atoi(value);
        else if (!strcmp(name, "max-stats"))
                ctx.cfg.max_msg_len = atoi(value);
        else if (!strcmp(name, "max-repodesc-length"))
                ctx.cfg.max_repodesc_len = atoi(value);
 +      else if (!strcmp(name, "max-blob-size"))
 +              ctx.cfg.max_blob_size = atoi(value);
        else if (!strcmp(name, "max-repo-count"))
                ctx.cfg.max_repo_count = atoi(value);
        else if (!strcmp(name, "max-commit-count"))
                ctx.cfg.summary_branches = atoi(value);
        else if (!strcmp(name, "summary-tags"))
                ctx.cfg.summary_tags = atoi(value);
 +      else if (!strcmp(name, "side-by-side-diffs"))
 +              ctx.cfg.ssdiff = atoi(value);
        else if (!strcmp(name, "agefile"))
                ctx.cfg.agefile = xstrdup(value);
        else if (!strcmp(name, "renamelimit"))
@@@ -244,8 -244,6 +248,8 @@@ static void querystring_cb(const char *
                ctx.qry.showmsg = atoi(value);
        } else if (!strcmp(name, "period")) {
                ctx.qry.period = xstrdup(value);
 +      } else if (!strcmp(name, "ss")) {
 +              ctx.qry.ssdiff = atoi(value);
        }
  }
  
@@@ -276,7 -274,6 +280,7 @@@ static void prepare_context(struct cgit
        ctx->cfg.max_lock_attempts = 5;
        ctx->cfg.max_msg_len = 80;
        ctx->cfg.max_repodesc_len = 80;
 +      ctx->cfg.max_blob_size = 0;
        ctx->cfg.max_stats = 0;
        ctx->cfg.module_link = "./?repo=%s&page=commit&id=%s";
        ctx->cfg.renamelimit = -1;
        ctx->cfg.summary_branches = 10;
        ctx->cfg.summary_log = 10;
        ctx->cfg.summary_tags = 10;
 +      ctx->cfg.ssdiff = 0;
        ctx->env.cgit_config = xstrdupn(getenv("CGIT_CONFIG"));
        ctx->env.http_host = xstrdupn(getenv("HTTP_HOST"));
        ctx->env.https = xstrdupn(getenv("HTTPS"));
diff --combined cgit.h
index 5941ec00a36c89ceef3b07fb880a8f970134729d,1de23352fd23b7310ffb6709f2ec1674a6959071..cd4af7247b7c00dd9562917d2df94472d2e1317e
--- 1/cgit.h
--- 2/cgit.h
+++ b/cgit.h
@@@ -72,6 -72,7 +72,7 @@@ struct cgit_repo 
        int snapshots;
        int enable_log_filecount;
        int enable_log_linecount;
+       int enable_remote_branches;
        int max_stats;
        time_t mtime;
        struct cgit_filter *about_filter;
@@@ -143,7 -144,6 +144,7 @@@ struct cgit_query 
        int nohead;
        char *sort;
        int showmsg;
 +      int ssdiff;
  };
  
  struct cgit_config {
        int enable_index_links;
        int enable_log_filecount;
        int enable_log_linecount;
+       int enable_remote_branches;
        int enable_tree_linenumbers;
        int local_time;
        int max_repo_count;
        int max_lock_attempts;
        int max_msg_len;
        int max_repodesc_len;
 +      int max_blob_size;
        int max_stats;
        int nocache;
        int noplainemail;
        int summary_branches;
        int summary_log;
        int summary_tags;
 +      int ssdiff;
        struct string_list mimetypes;
        struct cgit_filter *about_filter;
        struct cgit_filter *commit_filter;
diff --combined cgitrc.5.txt
index 70e4c78417992d3bdeb8fb6ba828cc59914f5983,0bb429a0f03c42f6f9f42738880f446889cdea58..d74d9e7eec85582be2548319aa415d5ff97ea7a9
@@@ -110,6 -110,11 +110,11 @@@ enable-log-linecount:
        and removed lines for each commit on the repository log page. Default
        value: "0".
  
+ enable-remote-branches::
+       Flag which, when set to "1", will make cgit display remote branches
+       in the summary and refs views. Default value: "0". See also:
+       "repo.enable-remote-branches".
  enable-tree-linenumbers::
        Flag which, when set to "1", will make cgit generate linenumber links
        for plaintext blobs printed in the tree view. Default value: "1".
@@@ -177,10 -182,6 +182,10 @@@ max-repodesc-length:
        Specifies the maximum number of repo description characters to display
        on the repository index page. Default value: "80".
  
 +max-blob-size::
 +      Specifies the maximum size of a blob to display HTML for in KBytes.
 +      Default value: "0" (limit disabled).
 +
  max-stats::
        Set the default maximum statistics period. Valid values are "week",
        "month", "quarter" and "year". If unspecified, statistics are
@@@ -245,10 -246,6 +250,10 @@@ section:
        after this option will inherit the current section name. Default value:
        none.
  
 +side-by-side-diffs::
 +      If set to "1" shows side-by-side diffs instead of unidiffs per
 +      default. Default value: "0".
 +
  snapshots::
        Text which specifies the default set of snapshot formats generated by
        cgit. The value is a space-separated list of zero or more of the
@@@ -312,6 -309,10 +317,10 @@@ repo.enable-log-linecount:
        A flag which can be used to disable the global setting
        `enable-log-linecount'. Default value: none.
  
+ repo.enable-remote-branches::
+       Flag which, when set to "1", will make cgit display remote branches
+       in the summary and refs views. Default value: <enable-remote-branches>.
  repo.max-stats::
        Override the default maximum statistics period. Valid values are equal
        to the values specified for the global "max-stats" setting. Default
diff --combined ui-refs.c
index 33d9bec2d8debc53c6b6c66cdd78b97e6cb45b03,b3489eeff97a78e1bfa5df694754ba733e61e9f6..98738dba6e74f00b22bd86e635d41a733d8acd08
+++ b/ui-refs.c
@@@ -74,7 -74,7 +74,7 @@@ static int print_branch(struct refinfo 
        html("</td><td>");
  
        if (ref->object->type == OBJ_COMMIT) {
 -              cgit_commit_link(info->subject, NULL, NULL, name, NULL);
 +              cgit_commit_link(info->subject, NULL, NULL, name, NULL, 0);
                html("</td><td>");
                html_txt(info->author);
                html("</td><td colspan='2'>");
@@@ -187,6 -187,8 +187,8 @@@ void cgit_print_branches(int maxcount
        list.refs = NULL;
        list.alloc = list.count = 0;
        for_each_branch_ref(cgit_refs_cb, &list);
+       if (ctx.repo->enable_remote_branches)
+               for_each_remote_ref(cgit_refs_cb, &list);
  
        if (maxcount == 0 || maxcount > list.count)
                maxcount = list.count;