summaryrefslogtreecommitdiffabout
Side-by-side diff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--Makefile2
-rw-r--r--cache.c4
m---------git0
-rwxr-xr-xtests/setup.sh6
-rw-r--r--ui-plain.c2
5 files changed, 8 insertions, 6 deletions
diff --git a/Makefile b/Makefile
index 561af76..f79688c 100644
--- a/Makefile
+++ b/Makefile
@@ -1,31 +1,31 @@
CGIT_VERSION = v0.8.1
CGIT_SCRIPT_NAME = cgit.cgi
CGIT_SCRIPT_PATH = /var/www/htdocs/cgit
CGIT_CONFIG = /etc/cgitrc
CACHE_ROOT = /var/cache/cgit
SHA1_HEADER = <openssl/sha.h>
-GIT_VER = 1.6.0.2
+GIT_VER = 1.6.0.3
GIT_URL = http://www.kernel.org/pub/software/scm/git/git-$(GIT_VER).tar.bz2
#
# Let the user override the above settings.
#
-include cgit.conf
#
# Define a way to invoke make in subdirs quietly, shamelessly ripped
# from git.git
#
QUIET_SUBDIR0 = +$(MAKE) -C # space to separate -C and subdir
QUIET_SUBDIR1 =
ifneq ($(findstring $(MAKEFLAGS),w),w)
PRINT_DIR = --no-print-directory
else # "make -w"
NO_SUBDIR = :
endif
ifndef V
QUIET_CC = @echo ' ' CC $@;
QUIET_MM = @echo ' ' MM $@;
QUIET_SUBDIR0 = +@subdir=
diff --git a/cache.c b/cache.c
index 57068a1..d7a8d5a 100644
--- a/cache.c
+++ b/cache.c
@@ -395,45 +395,45 @@ int cache_ls(const char *path)
}
dir = opendir(path);
if (!dir) {
err = errno;
cache_log("[cgit] unable to open path %s: %s (%d)\n",
path, strerror(err), err);
return err;
}
strcpy(fullname, path);
name = fullname + strlen(path);
if (*(name - 1) != '/') {
*name++ = '/';
*name = '\0';
}
slot.cache_name = fullname;
while((ent = readdir(dir)) != NULL) {
if (strlen(ent->d_name) != 8)
continue;
strcpy(name, ent->d_name);
if ((err = open_slot(&slot)) != 0) {
cache_log("[cgit] unable to open path %s: %s (%d)\n",
fullname, strerror(err), err);
continue;
}
- printf("%s %s %10zd %s\n",
+ printf("%s %s %10"PRIuMAX" %s\n",
name,
sprintftime("%Y-%m-%d %H:%M:%S",
slot.cache_st.st_mtime),
- slot.cache_st.st_size,
+ (uintmax_t)slot.cache_st.st_size,
slot.buf);
close_slot(&slot);
}
closedir(dir);
return 0;
}
/* Print a message to stdout */
void cache_log(const char *format, ...)
{
va_list args;
va_start(args, format);
vfprintf(stderr, format, args);
va_end(args);
}
diff --git a/git b/git
-Subproject 97a7a82f199f165f85fe39a3c318b18c621e633
+Subproject 031e6c898f61db1ae0c0be641eac6532c1000d5
diff --git a/tests/setup.sh b/tests/setup.sh
index 1457dd5..95acb54 100755
--- a/tests/setup.sh
+++ b/tests/setup.sh
@@ -4,53 +4,55 @@
# prepare_tests(description) - setup for testing, i.e. create repos+config
# run_test(description, script) - run one test, i.e. eval script
#
# Helper functions
# cgit_query(querystring) - call cgit with the specified querystring
# cgit_url(url) - call cgit with the specified virtual url
#
# Example script:
#
# . setup.sh
# prepare_tests "html validation"
# run_test 'repo index' 'cgit_url "/" | tidy -e'
# run_test 'repo summary' 'cgit_url "/foo" | tidy -e'
mkrepo() {
name=$1
count=$2
dir=$PWD
test -d $name && return
printf "Creating testrepo %s\n" $name
mkdir -p $name
cd $name
git init
- for ((n=1; n<=count; n++))
+ n=1
+ while test $n -le $count
do
echo $n >file-$n
git add file-$n
git commit -m "commit $n"
+ n=$(expr $n + 1)
done
if test "$3" = "testplus"
then
echo "hello" >a+b
git add a+b
git commit -m "add a+b"
git branch "1+2"
fi
cd $dir
}
setup_repos()
{
rm -rf trash/cache
mkdir -p trash/cache
mkrepo trash/repos/foo 5 >/dev/null
mkrepo trash/repos/bar 50 >/dev/null
mkrepo trash/repos/foo+bar 10 testplus >/dev/null
cat >trash/cgitrc <<EOF
virtual-root=/
cache-root=$PWD/trash/cache
cache-size=1021
snapshots=tar.gz tar.bz zip
@@ -80,48 +82,48 @@ prepare_tests()
{
setup_repos
rm -f test-output.log 2>/dev/null
test_count=0
test_failed=0
echo "[$0]" "$@" >test-output.log
echo "$@" "($0)"
}
tests_done()
{
printf "\n"
if test $test_failed -gt 0
then
printf "test: *** %s failure(s), logfile=%s\n" \
$test_failed "$(pwd)/test-output.log"
false
fi
}
run_test()
{
desc=$1
script=$2
- ((test_count++))
+ test_count=$(expr $test_count + 1)
printf "\ntest %d: name='%s'\n" $test_count "$desc" >>test-output.log
printf "test %d: eval='%s'\n" $test_count "$2" >>test-output.log
eval "$2" >>test-output.log 2>>test-output.log
res=$?
printf "test %d: exitcode=%d\n" $test_count $res >>test-output.log
if test $res = 0
then
printf " %2d) %-60s [ok]\n" $test_count "$desc"
else
((test_failed++))
printf " %2d) %-60s [failed]\n" $test_count "$desc"
fi
}
cgit_query()
{
CGIT_CONFIG="$PWD/trash/cgitrc" QUERY_STRING="$1" "$PWD/../cgit"
}
cgit_url()
{
CGIT_CONFIG="$PWD/trash/cgitrc" QUERY_STRING="url=$1" "$PWD/../cgit"
}
diff --git a/ui-plain.c b/ui-plain.c
index be559e0..5addd9e 100644
--- a/ui-plain.c
+++ b/ui-plain.c
@@ -1,45 +1,45 @@
/* ui-plain.c: functions for output of plain blobs by path
*
* Copyright (C) 2008 Lars Hjemli
*
* Licensed under GNU General Public License v2
* (see COPYING for full license text)
*/
#include "cgit.h"
#include "html.h"
#include "ui-shared.h"
char *curr_rev;
char *match_path;
int match;
static void print_object(const unsigned char *sha1, const char *path)
{
enum object_type type;
char *buf;
- size_t size;
+ unsigned long size;
type = sha1_object_info(sha1, &size);
if (type == OBJ_BAD) {
html_status(404, "Not found", 0);
return;
}
buf = read_sha1_file(sha1, &type, &size);
if (!buf) {
html_status(404, "Not found", 0);
return;
}
ctx.page.mimetype = "text/plain";
ctx.page.filename = fmt("%s", path);
ctx.page.size = size;
cgit_print_http_headers(&ctx);
html_raw(buf, size);
match = 1;
}
static int walk_tree(const unsigned char *sha1, const char *base, int baselen,
const char *pathname, unsigned mode, int stage,
void *cbdata)
{