From: Lars Hjemli Date: Tue, 8 Dec 2009 18:34:30 +0000 (+0100) Subject: Merge branch 'lh/remote-branches' X-Git-Url: https://gitweb.ps.run/ps-cgit/commitdiff_plain/4e75d7c9b93010663963d362099777b77a67c446?hp=-c Merge branch 'lh/remote-branches' --- 4e75d7c9b93010663963d362099777b77a67c446 diff --combined cgit.c index 4f68a4b,29813cd..e46c00a --- a/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")) @@@ -165,8 -169,6 +169,8 @@@ 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")) @@@ -184,8 -186,6 +188,8 @@@ 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; @@@ -288,7 -285,6 +292,7 @@@ 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 5941ec0,1de2335..cd4af72 --- a/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 { @@@ -179,6 -179,7 +180,7 @@@ 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; @@@ -186,7 -187,6 +188,7 @@@ int max_lock_attempts; int max_msg_len; int max_repodesc_len; + int max_blob_size; int max_stats; int nocache; int noplainemail; @@@ -196,7 -196,6 +198,7 @@@ 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 70e4c78,0bb429a..d74d9e7 --- a/cgitrc.5.txt +++ b/cgitrc.5.txt @@@ -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: . + 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 33d9bec,b3489ee..98738db --- a/ui-refs.c +++ b/ui-refs.c @@@ -74,7 -74,7 +74,7 @@@ static int print_branch(struct refinfo html(""); 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(""); html_txt(info->author); html(""); @@@ -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;