aboutsummaryrefslogtreecommitdiffstats
path: root/cgit.c
diff options
context:
space:
mode:
authorGravatar Jason A. Donenfeld <Jason@zx2c4.com>2013-04-08 23:57:12 (JST)
committerGravatar Jason A. Donenfeld <Jason@zx2c4.com>2013-04-10 21:48:26 (JST)
commit389cc17357e2040c9542d3e085f64a8d2f085e9a (patch)
tree0696cd47fead7576cf03f06eec067b3e5b2c365a /cgit.c
parent880223dc845e8b502e753425b889cbb70b73478e (diff)
downloadcgit-389cc17357e2040c9542d3e085f64a8d2f085e9a.zip
cgit-389cc17357e2040c9542d3e085f64a8d2f085e9a.tar.gz
Add branch-sort and repo.branch-sort options.
When set to "name", branches are sorted by name, which is the current default. When set to "age", branches are sorted by the age of the repository. This feature was requested by Konstantin Ryabitsev for use on kernel.org. Proposed-by: Konstantin Ryabitsev <mricon@kernel.org>
Diffstat (limited to 'cgit.c')
-rw-r--r--cgit.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/cgit.c b/cgit.c
index 4dadd97..6f44ef2 100644
--- a/cgit.c
+++ b/cgit.c
@@ -84,7 +84,12 @@ static void repo_config(struct cgit_repo *repo, const char *name, const char *va
84 repo->enable_remote_branches = atoi(value); 84 repo->enable_remote_branches = atoi(value);
85 else if (!strcmp(name, "enable-subject-links")) 85 else if (!strcmp(name, "enable-subject-links"))
86 repo->enable_subject_links = atoi(value); 86 repo->enable_subject_links = atoi(value);
87 else if (!strcmp(name, "commit-sort")) { 87 else if (!strcmp(name, "branch-sort")) {
88 if (!strcmp(value, "age"))
89 repo->branch_sort = 1;
90 if (!strcmp(value, "name"))
91 repo->branch_sort = 0;
92 } else if (!strcmp(name, "commit-sort")) {
88 if (!strcmp(value, "date")) 93 if (!strcmp(value, "date"))
89 repo->commit_sort = 1; 94 repo->commit_sort = 1;
90 if (!strcmp(value, "topo")) 95 if (!strcmp(value, "topo"))
@@ -271,6 +276,11 @@ static void config_cb(const char *name, const char *value)
271 ctx.cfg.commit_sort = 1; 276 ctx.cfg.commit_sort = 1;
272 if (!strcmp(value, "topo")) 277 if (!strcmp(value, "topo"))
273 ctx.cfg.commit_sort = 2; 278 ctx.cfg.commit_sort = 2;
279 } else if (!strcmp(name, "branch-sort")) {
280 if (!strcmp(value, "age"))
281 ctx.cfg.branch_sort = 1;
282 if (!strcmp(value, "name"))
283 ctx.cfg.branch_sort = 0;
274 } else if (!prefixcmp(name, "mimetype.")) 284 } else if (!prefixcmp(name, "mimetype."))
275 add_mimetype(name + 9, value); 285 add_mimetype(name + 9, value);
276 else if (!strcmp(name, "include")) 286 else if (!strcmp(name, "include"))
@@ -345,6 +355,8 @@ static void prepare_context(struct cgit_context *ctx)
345 ctx->cfg.cache_scanrc_ttl = 15; 355 ctx->cfg.cache_scanrc_ttl = 15;
346 ctx->cfg.cache_static_ttl = -1; 356 ctx->cfg.cache_static_ttl = -1;
347 ctx->cfg.case_sensitive_sort = 1; 357 ctx->cfg.case_sensitive_sort = 1;
358 ctx->cfg.branch_sort = 0;
359 ctx->cfg.commit_sort = 0;
348 ctx->cfg.css = "/cgit.css"; 360 ctx->cfg.css = "/cgit.css";
349 ctx->cfg.logo = "/cgit.png"; 361 ctx->cfg.logo = "/cgit.png";
350 ctx->cfg.local_time = 0; 362 ctx->cfg.local_time = 0;