aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Makefile28
-rw-r--r--cache.h1
-rw-r--r--cgit.c86
-rw-r--r--cgit.css148
-rw-r--r--cgit.h26
-rw-r--r--cgitrc.5.txt68
-rw-r--r--cmd.c48
-rw-r--r--cmd.h3
-rwxr-xr-xfilters/commit-links.sh16
-rwxr-xr-xfilters/syntax-highlighting.sh29
-rw-r--r--html.c84
-rw-r--r--html.h21
-rw-r--r--scan-tree.c123
-rw-r--r--scan-tree.h3
-rw-r--r--shared.c90
-rw-r--r--ui-atom.c4
-rw-r--r--ui-blob.c37
-rw-r--r--ui-blob.h1
-rw-r--r--ui-commit.c46
-rw-r--r--ui-commit.h2
-rw-r--r--ui-diff.c94
-rw-r--r--ui-log.c56
-rw-r--r--ui-patch.c8
-rw-r--r--ui-patch.h2
-rw-r--r--ui-plain.c68
-rw-r--r--ui-refs.c4
-rw-r--r--ui-repolist.c6
-rw-r--r--ui-shared.c270
-rw-r--r--ui-shared.h71
-rw-r--r--ui-snapshot.c14
-rw-r--r--ui-ssdiff.c369
-rw-r--r--ui-ssdiff.h13
-rw-r--r--ui-stats.c18
-rw-r--r--ui-summary.c42
-rw-r--r--ui-tag.c24
-rw-r--r--ui-tree.c27
36 files changed, 1613 insertions, 337 deletions
diff --git a/Makefile b/Makefile
index 2dae3ac..dda743d 100644
--- a/Makefile
+++ b/Makefile
@@ -11,8 +11,16 @@ INSTALL = install
11 11
12# Define NO_STRCASESTR if you don't have strcasestr. 12# Define NO_STRCASESTR if you don't have strcasestr.
13# 13#
14# Define NO_OPENSSL to disable linking with OpenSSL and use bundled SHA1
15# implementation (slower).
16#
14# Define NEEDS_LIBICONV if linking with libc is not enough (eg. Darwin). 17# Define NEEDS_LIBICONV if linking with libc is not enough (eg. Darwin).
15# 18#
19# Define NO_C99_FORMAT if your formatted IO functions (printf/scanf et.al.)
20# do not support the 'size specifiers' introduced by C99, namely ll, hh,
21# j, z, t. (representing long long int, char, intmax_t, size_t, ptrdiff_t).
22# some C compilers supported these specifiers prior to C99 as an extension.
23#
16 24
17#-include config.mak 25#-include config.mak
18 26
@@ -68,7 +76,7 @@ endif
68 $(QUIET_CC)$(CC) -o $*.o -c $(CFLAGS) $< 76 $(QUIET_CC)$(CC) -o $*.o -c $(CFLAGS) $<
69 77
70 78
71EXTLIBS = git/libgit.a git/xdiff/lib.a -lz -lcrypto -lpthread 79EXTLIBS = git/libgit.a git/xdiff/lib.a -lz -lpthread
72OBJECTS = 80OBJECTS =
73OBJECTS += cache.o 81OBJECTS += cache.o
74OBJECTS += cgit.o 82OBJECTS += cgit.o
@@ -90,6 +98,7 @@ OBJECTS += ui-refs.o
90OBJECTS += ui-repolist.o 98OBJECTS += ui-repolist.o
91OBJECTS += ui-shared.o 99OBJECTS += ui-shared.o
92OBJECTS += ui-snapshot.o 100OBJECTS += ui-snapshot.o
101OBJECTS += ui-ssdiff.o
93OBJECTS += ui-stats.o 102OBJECTS += ui-stats.o
94OBJECTS += ui-summary.o 103OBJECTS += ui-summary.o
95OBJECTS += ui-tag.o 104OBJECTS += ui-tag.o
@@ -123,17 +132,28 @@ endif
123ifdef NO_STRCASESTR 132ifdef NO_STRCASESTR
124 CFLAGS += -DNO_STRCASESTR 133 CFLAGS += -DNO_STRCASESTR
125endif 134endif
135ifdef NO_C99_FORMAT
136 CFLAGS += -DNO_C99_FORMAT
137endif
138ifdef NO_OPENSSL
139 CFLAGS += -DNO_OPENSSL
140 GIT_OPTIONS += NO_OPENSSL=1
141else
142 EXTLIBS += -lcrypto
143endif
126 144
127cgit: $(OBJECTS) libgit 145cgit: $(OBJECTS) libgit
128 $(QUIET_CC)$(CC) $(CFLAGS) $(LDFLAGS) -o cgit $(OBJECTS) $(EXTLIBS) 146 $(QUIET_CC)$(CC) $(CFLAGS) $(LDFLAGS) -o cgit $(OBJECTS) $(EXTLIBS)
129 147
130cgit.o: VERSION 148cgit.o: VERSION
131 149
132-include $(OBJECTS:.o=.d) 150ifneq "$(MAKECMDGOALS)" "clean"
151 -include $(OBJECTS:.o=.d)
152endif
133 153
134libgit: 154libgit:
135 $(QUIET_SUBDIR0)git $(QUIET_SUBDIR1) NO_CURL=1 libgit.a 155 $(QUIET_SUBDIR0)git $(QUIET_SUBDIR1) NO_CURL=1 $(GIT_OPTIONS) libgit.a
136 $(QUIET_SUBDIR0)git $(QUIET_SUBDIR1) NO_CURL=1 xdiff/lib.a 156 $(QUIET_SUBDIR0)git $(QUIET_SUBDIR1) NO_CURL=1 $(GIT_OPTIONS) xdiff/lib.a
137 157
138test: all 158test: all
139 $(QUIET_SUBDIR0)tests $(QUIET_SUBDIR1) all 159 $(QUIET_SUBDIR0)tests $(QUIET_SUBDIR1) all
diff --git a/cache.h b/cache.h
index ac9276b..5cfdb4f 100644
--- a/cache.h
+++ b/cache.h
@@ -30,6 +30,7 @@ extern int cache_process(int size, const char *path, const char *key, int ttl,
30extern int cache_ls(const char *path); 30extern int cache_ls(const char *path);
31 31
32/* Print a message to stdout */ 32/* Print a message to stdout */
33__attribute__((format (printf,1,2)))
33extern void cache_log(const char *format, ...); 34extern void cache_log(const char *format, ...);
34 35
35extern unsigned long hash_str(const char *str); 36extern unsigned long hash_str(const char *str);
diff --git a/cgit.c b/cgit.c
index ad62d10..96900bb 100644
--- a/cgit.c
+++ b/cgit.c
@@ -1,6 +1,7 @@
1/* cgit.c: cgi for the git scm 1/* cgit.c: cgi for the git scm
2 * 2 *
3 * Copyright (C) 2006 Lars Hjemli 3 * Copyright (C) 2006 Lars Hjemli
4 * Copyright (C) 2010 Jason A. Donenfeld <Jason@zx2c4.com>
4 * 5 *
5 * Licensed under GNU General Public License v2 6 * Licensed under GNU General Public License v2
6 * (see COPYING for full license text) 7 * (see COPYING for full license text)
@@ -60,6 +61,10 @@ void repo_config(struct cgit_repo *repo, const char *name, const char *value)
60 repo->enable_log_filecount = ctx.cfg.enable_log_filecount * atoi(value); 61 repo->enable_log_filecount = ctx.cfg.enable_log_filecount * atoi(value);
61 else if (!strcmp(name, "enable-log-linecount")) 62 else if (!strcmp(name, "enable-log-linecount"))
62 repo->enable_log_linecount = ctx.cfg.enable_log_linecount * atoi(value); 63 repo->enable_log_linecount = ctx.cfg.enable_log_linecount * atoi(value);
64 else if (!strcmp(name, "enable-remote-branches"))
65 repo->enable_remote_branches = atoi(value);
66 else if (!strcmp(name, "enable-subject-links"))
67 repo->enable_subject_links = atoi(value);
63 else if (!strcmp(name, "max-stats")) 68 else if (!strcmp(name, "max-stats"))
64 repo->max_stats = cgit_find_stats_period(value, NULL); 69 repo->max_stats = cgit_find_stats_period(value, NULL);
65 else if (!strcmp(name, "module-link")) 70 else if (!strcmp(name, "module-link"))
@@ -67,10 +72,7 @@ void repo_config(struct cgit_repo *repo, const char *name, const char *value)
67 else if (!strcmp(name, "section")) 72 else if (!strcmp(name, "section"))
68 repo->section = xstrdup(value); 73 repo->section = xstrdup(value);
69 else if (!strcmp(name, "readme") && value != NULL) { 74 else if (!strcmp(name, "readme") && value != NULL) {
70 if (*value == '/') 75 repo->readme = xstrdup(value);
71 repo->readme = xstrdup(value);
72 else
73 repo->readme = xstrdup(fmt("%s/%s", repo->path, value));
74 } else if (ctx.cfg.enable_filter_overrides) { 76 } else if (ctx.cfg.enable_filter_overrides) {
75 if (!strcmp(name, "about-filter")) 77 if (!strcmp(name, "about-filter"))
76 repo->about_filter = new_filter(value, 0); 78 repo->about_filter = new_filter(value, 0);
@@ -91,6 +93,8 @@ void config_cb(const char *name, const char *value)
91 ctx.repo->path = trim_end(value, '/'); 93 ctx.repo->path = trim_end(value, '/');
92 else if (ctx.repo && !prefixcmp(name, "repo.")) 94 else if (ctx.repo && !prefixcmp(name, "repo."))
93 repo_config(ctx.repo, name + 5, value); 95 repo_config(ctx.repo, name + 5, value);
96 else if (!strcmp(name, "readme"))
97 ctx.cfg.readme = xstrdup(value);
94 else if (!strcmp(name, "root-title")) 98 else if (!strcmp(name, "root-title"))
95 ctx.cfg.root_title = xstrdup(value); 99 ctx.cfg.root_title = xstrdup(value);
96 else if (!strcmp(name, "root-desc")) 100 else if (!strcmp(name, "root-desc"))
@@ -131,12 +135,18 @@ void config_cb(const char *name, const char *value)
131 ctx.cfg.snapshots = cgit_parse_snapshots_mask(value); 135 ctx.cfg.snapshots = cgit_parse_snapshots_mask(value);
132 else if (!strcmp(name, "enable-filter-overrides")) 136 else if (!strcmp(name, "enable-filter-overrides"))
133 ctx.cfg.enable_filter_overrides = atoi(value); 137 ctx.cfg.enable_filter_overrides = atoi(value);
138 else if (!strcmp(name, "enable-gitweb-owner"))
</