aboutsummaryrefslogtreecommitdiff
path: root/cgit.c
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2013-04-08 16:57:12 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2013-04-10 14:48:26 +0200
commit389cc17357e2040c9542d3e085f64a8d2f085e9a (patch)
tree0696cd47fead7576cf03f06eec067b3e5b2c365a /cgit.c
parent880223dc845e8b502e753425b889cbb70b73478e (diff)
downloadcgit-389cc17357e2040c9542d3e085f64a8d2f085e9a.tar.gz
cgit-389cc17357e2040c9542d3e085f64a8d2f085e9a.tar.bz2
cgit-389cc17357e2040c9542d3e085f64a8d2f085e9a.zip
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
repo->enable_remote_branches = atoi(value);
else if (!strcmp(name, "enable-subject-links"))
repo->enable_subject_links = atoi(value);
- else if (!strcmp(name, "commit-sort")) {
+ else if (!strcmp(name, "branch-sort")) {
+ if (!strcmp(value, "age"))
+ repo->branch_sort = 1;
+ if (!strcmp(value, "name"))
+ repo->branch_sort = 0;
+ } else if (!strcmp(name, "commit-sort")) {
if (!strcmp(value, "date"))
repo->commit_sort = 1;
if (!strcmp(value, "topo"))
@@ -271,6 +276,11 @@ static void config_cb(const char *name, const char *value)
ctx.cfg.commit_sort = 1;
if (!strcmp(value, "topo"))
ctx.cfg.commit_sort = 2;
+ } else if (!strcmp(name, "branch-sort")) {
+ if (!strcmp(value, "age"))
+ ctx.cfg.branch_sort = 1;
+ if (!strcmp(value, "name"))
+ ctx.cfg.branch_sort = 0;
} else if (!prefixcmp(name, "mimetype."))
add_mimetype(name + 9, value);
else if (!strcmp(name, "include"))
@@ -345,6 +355,8 @@ static void prepare_context(struct cgit_context *ctx)
ctx->cfg.cache_scanrc_ttl = 15;
ctx->cfg.cache_static_ttl = -1;
ctx->cfg.case_sensitive_sort = 1;
+ ctx->cfg.branch_sort = 0;
+ ctx->cfg.commit_sort = 0;
ctx->cfg.css = "/cgit.css";
ctx->cfg.logo = "/cgit.png";
ctx->cfg.local_time = 0;