List for cgit developers and users
 help / color / mirror / Atom feed
From: Tobias.Bieniek at gmx.de (Tobias Bieniek)
Subject: [PATCH 1/3] Added "sort-sections" flag for the repository listing
Date: Mon,  2 Jul 2012 17:38:56 +0200	[thread overview]
Message-ID: <1341243538-15160-1-git-send-email-Tobias.Bieniek@gmx.de> (raw)

Flag which, when set to "1", will make sort the sections on the
repository listing by name. Set this flag to "0" if the order in the
cgitrc file should be preserved. Default value: "1".
---
 cgit.c        |    3 +++
 cgit.h        |    1 +
 cgitrc.5.txt  |    5 +++++
 ui-repolist.c |    2 +-
 4 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/cgit.c b/cgit.c
index b9b3a66..4ec00f6 100644
--- a/cgit.c
+++ b/cgit.c
@@ -229,6 +229,8 @@ void config_cb(const char *name, const char *value)
 		ctx.cfg.scan_hidden_path = atoi(value);
 	else if (!strcmp(name, "section-from-path"))
 		ctx.cfg.section_from_path = atoi(value);
+	else if (!strcmp(name, "sort-sections"))
+		ctx.cfg.sort_sections = atoi(value);
 	else if (!strcmp(name, "source-filter"))
 		ctx.cfg.source_filter = new_filter(value, SOURCE);
 	else if (!strcmp(name, "summary-log"))
@@ -355,6 +357,7 @@ static void prepare_context(struct cgit_context *ctx)
 	ctx->cfg.scan_hidden_path = 0;
 	ctx->cfg.script_name = CGIT_SCRIPT_NAME;
 	ctx->cfg.section = "";
+	ctx->cfg.sort_sections = 1;
 	ctx->cfg.summary_branches = 10;
 	ctx->cfg.summary_log = 10;
 	ctx->cfg.summary_tags = 10;
diff --git a/cgit.h b/cgit.h
index 6ee6769..86afad1 100644
--- a/cgit.h
+++ b/cgit.h
@@ -224,6 +224,7 @@ struct cgit_config {
 	int scan_hidden_path;
 	int section_from_path;
 	int snapshots;
+	int sort_sections;
 	int summary_branches;
 	int summary_log;
 	int summary_tags;
diff --git a/cgitrc.5.txt b/cgitrc.5.txt
index a72241f..3e2d87f 100644
--- a/cgitrc.5.txt
+++ b/cgitrc.5.txt
@@ -336,6 +336,11 @@ snapshots::
 	values "tar", "tar.gz", "tar.bz2", "tar.xz" and "zip". Default value:
 	none.
 
+sort-sections::
+	Flag which, when set to "1", will make sort the sections on the
+	repository listing by name. Set this flag to "0" if the order in the
+	cgitrc file should be preserved. Default value: "1".
+
 source-filter::
 	Specifies a command which will be invoked to format plaintext blobs
 	in the tree view. The command will get the blob content on its STDIN
diff --git a/ui-repolist.c b/ui-repolist.c
index d946f32..4cf3ec1 100644
--- a/ui-repolist.c
+++ b/ui-repolist.c
@@ -237,7 +237,7 @@ void cgit_print_repolist()
 
 	if(ctx.qry.sort)
 		sorted = sort_repolist(ctx.qry.sort);
-	else
+	else if (ctx.cfg.sort_sections)
 		sort_repolist("section");
 
 	html("<table summary='repository list' class='list nowrap'>");
-- 
1.7.10





             reply	other threads:[~2012-07-02 15:38 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-02 15:38 Tobias.Bieniek [this message]
2012-07-02 15:38 ` [PATCH 2/3] Added "date-order" and "topo-order" flags Tobias.Bieniek
2012-07-02 15:38 ` [PATCH 3/3] Fixed parameter parsing in repo_config() function Tobias.Bieniek
     [not found] ` <CABEOeT=yfWaqRfanCcgVYLkTa3PD8JtkfvY2NfTGxNOAO2PEFQ@mail.gmail.com>
2012-10-08 21:11   ` [PATCH 1/3] Added "sort-sections" flag for the repository listing Jason
2012-10-09 18:59     ` Tobias.Bieniek
2012-10-09 19:03       ` Jason
2012-10-09 19:10         ` Jason
2012-10-09 19:11           ` Jason
2012-10-09 21:54             ` Tobias.Bieniek
2012-10-09 22:16               ` Jason
2012-10-09 21:49           ` Tobias.Bieniek
2012-10-09 22:15             ` Jason
2012-10-09 22:26               ` Tobias.Bieniek
2012-10-13 14:24           ` Tobias.Bieniek
2012-10-09 21:47         ` Tobias.Bieniek
2012-10-09 19:12       ` Jason

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1341243538-15160-1-git-send-email-Tobias.Bieniek@gmx.de \
    --to=cgit@lists.zx2c4.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).