development/cgit: Updated for version 20130826_d62e71a.

Signed-off-by: Matteo Bernardini <ponce@slackbuilds.org>
This commit is contained in:
Matteo Bernardini 2013-08-29 16:37:57 +02:00 committed by Robby Workman
parent 7d9598c7e3
commit 53589ff94f
4 changed files with 32 additions and 97 deletions

View file

@ -1,11 +1,28 @@
#!/bin/sh
# Slackware build script for cgit
# Written by Matteo Bernardini <ponce@slackbuilds.org>
# Copyright 2013 Matteo Bernardini <ponce@slackbuilds.org>, Pisa, Italy
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
# permitted provided that the following conditions are met:
#
# 1. Redistributions of this script must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED
# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
PRGNAM=cgit
VERSION=${VERSION:-20120318_f50be7f}
CGIT_VERSION=${CGIT_VERSION:-v0.9.0.3-4-gf50b}
VERSION=${VERSION:-20130826_d62e71a}
BUILD=${BUILD:-1}
TAG=${TAG:-_SBo}
@ -36,11 +53,12 @@ else
LIBDIRSUFFIX=""
fi
CGIT_VERSION=${CGIT_VERSION:-v0.9.2-21-gd62e}
GIT_VERSION=${GIT_VERSION:-1.8.4}
DOCS="cgitrc.5.txt COPYING README $CWD/config/cgit-lighttpd.conf \
$CWD/config/cgit-httpd.conf $CWD/config/cgitrc.sample"
GIT_TARBALL=$(grep \/git- $CWD/cgit.info | cut -d'/' -f7 | sed -e 's/\"//')
set -e
rm -rf $PKG
@ -56,9 +74,6 @@ find . \
\( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
-exec chmod 644 {} \;
# add a patch to sort summary branches
patch -p1 < $CWD/sort-summary-branches.patch
# prepare sources
sed -i -e "s|-g -Wall -Igit|-Wall ${SLKCFLAGS} -Igit|" Makefile
sed -i -e "s|\/lib$|/lib${LIBDIRSUFFIX}|" Makefile
@ -68,7 +83,7 @@ echo "CGIT_VERSION = $CGIT_VERSION" >> cgit.conf
# extract the git tarball
rm -fR git
tar xvf $CWD/$GIT_TARBALL
tar xvf $CWD/git-$GIT_VERSION.tar.?z*
mv git-* git
make

View file

@ -1,10 +1,10 @@
PRGNAM="cgit"
VERSION="20120318_f50be7f"
HOMEPAGE="http://hjemli.net/git/cgit/"
DOWNLOAD="http://ponce.cc/slackware/sources/repo/cgit-20120318_f50be7f.tar.xz \
http://ponce.cc/slackware/sources/repo/git-1.7.4.4.tar.xz"
MD5SUM="1aabbefa20502d85019d9bc62d12c16a \
992da984346a475cf6334efad396e229"
VERSION="20130826_d62e71a"
HOMEPAGE="http://git.zx2c4.com/cgit/about/"
DOWNLOAD="http://ponce.cc/slackware/sources/repo/cgit-20130826_d62e71a.tar.xz \
http://ponce.cc/slackware/sources/repo/git-1.8.4.tar.xz"
MD5SUM="e416a2ce78307ab3ea93bd7256d8409c \
fafd083b8286f901f3a373f0a985bf01"
DOWNLOAD_x86_64=""
MD5SUM_x86_64=""
REQUIRES=""

View file

@ -1,10 +1,12 @@
# sample /etc/cgitrc file: two repos are defined
# you can see a demo here http://cgit.ponce.cc/
# For more options, see cgitrc.5.txt in the docs folder
root-title=ponce's repository browser
root-desc=a fast interface to these git repositories
virtual-root=/
snapshots=tar.gz
branch-sort=age
#css=/static/cgit.css
#logo=/static/cgit.png

View file

@ -1,82 +0,0 @@
When there are more than `summary-branches` in a repo, the summary page
trimmed the list by age and then sorted them by name. Make sorting by
name optional, though keep it as the default.
Signed-off-by: Todd Zullinger <tmz at pobox.com>
---
This was requested by a friend for whom I setup cgit. I don't know if
it's a worthwhile option or not. It's handy for me to avoid having to
patch that install. Beware, my C is weak. If there are egregious
errors in style or content, I won't be shocked or offended to hear
about them.
cgit.c | 3 +++
cgit.h | 1 +
cgitrc.5.txt | 5 +++++
ui-refs.c | 4 +++-
4 files changed, 12 insertions(+), 1 deletions(-)
diff --git a/cgit.c b/cgit.c
index e302a7c..ebbcad1 100644
--- a/cgit.c
+++ b/cgit.c
@@ -233,6 +233,8 @@ void config_cb(const char *name, const char *value)
ctx.cfg.local_time = atoi(value);
else if (!prefixcmp(name, "mimetype."))
add_mimetype(name + 9, value);
+ else if (!strcmp(name, "summary-branches-sort"))
+ ctx.cfg.summary_branches_sort = xstrdup(value);
else if (!strcmp(name, "include"))
parse_configfile(expand_macros(value), config_cb);
}
@@ -331,6 +333,7 @@ static void prepare_context(struct cgit_context *ctx)
ctx->cfg.script_name = CGIT_SCRIPT_NAME;
ctx->cfg.section = "";
ctx->cfg.summary_branches = 10;
+ ctx->cfg.summary_branches_sort = "name";
ctx->cfg.summary_log = 10;
ctx->cfg.summary_tags = 10;
ctx->cfg.max_atom_items = 10;
diff --git a/cgit.h b/cgit.h
index b5f00fc..2f847a1 100644
--- a/cgit.h
+++ b/cgit.h
@@ -216,6 +216,7 @@ struct cgit_config {
int section_from_path;
int snapshots;
int summary_branches;
+ char *summary_branches_sort;
int summary_log;
int summary_tags;
int ssdiff;
diff --git a/cgitrc.5.txt b/cgitrc.5.txt
index 65b210f..1c8574b 100644
--- a/cgitrc.5.txt
+++ b/cgitrc.5.txt
@@ -324,6 +324,11 @@ summary-branches::
Specifies the number of branches to display in the repository "summary"
view. Default value: "10".
+summary-branches-sort::
+ Specifies the sort order to use for branches on the summary page, when
+ there are more than `summary-count` branches. Valid options are "name"
+ and "age". Default value: "name".
+
summary-log::
Specifies the number of log entries to display in the repository
"summary" view. Default value: "10".
diff --git a/ui-refs.c b/ui-refs.c
index caddfbc..188e63d 100644
--- a/ui-refs.c
+++ b/ui-refs.c
@@ -197,7 +197,9 @@ void cgit_print_branches(int maxcount)
if (maxcount < list.count) {
qsort(list.refs, list.count, sizeof(*list.refs), cmp_branch_age);
- qsort(list.refs, maxcount, sizeof(*list.refs), cmp_ref_name);
+ if (ctx.cfg.summary_branches_sort &&
+ !strcmp(ctx.cfg.summary_branches_sort, "name"))
+ qsort(list.refs, maxcount, sizeof(*list.refs), cmp_ref_name);
}
for(i=0; i<maxcount; i++)