diff options
| -rw-r--r-- | .gitignore | 5 | ||||
| -rw-r--r-- | Makefile | 21 | ||||
| -rw-r--r-- | cgit-doc.css | 3 | ||||
| -rw-r--r-- | cgit.c | 87 | ||||
| -rw-r--r-- | cgit.css | 2 | ||||
| -rw-r--r-- | cgit.h | 41 | ||||
| -rw-r--r-- | cgitrc.5.txt | 187 | ||||
| -rw-r--r-- | cmd.c | 2 | ||||
| -rwxr-xr-x | filters/commit-links.sh | 12 | ||||
| -rwxr-xr-x | filters/syntax-highlighting.sh | 39 | ||||
| m--------- | git | 0 | ||||
| -rw-r--r-- | shared.c | 38 | ||||
| -rw-r--r-- | ui-atom.c | 8 | ||||
| -rw-r--r-- | ui-blob.c | 8 | ||||
| -rw-r--r-- | ui-commit.c | 20 | ||||
| -rw-r--r-- | ui-log.c | 4 | ||||
| -rw-r--r-- | ui-patch.c | 6 | ||||
| -rw-r--r-- | ui-plain.c | 18 | ||||
| -rw-r--r-- | ui-refs.c | 19 | ||||
| -rw-r--r-- | ui-repolist.c | 9 | ||||
| -rw-r--r-- | ui-shared.c | 81 | ||||
| -rw-r--r-- | ui-shared.h | 1 | ||||
| -rw-r--r-- | ui-snapshot.c | 35 | ||||
| -rw-r--r-- | ui-summary.c | 28 | ||||
| -rw-r--r-- | ui-summary.h | 2 | ||||
| -rw-r--r-- | ui-tag.c | 2 | ||||
| -rw-r--r-- | ui-tree.c | 26 |
27 files changed, 553 insertions, 151 deletions
| @@ -2,5 +2,10 @@ | |||
| 2 | cgit | 2 | cgit |
| 3 | cgit.conf | 3 | cgit.conf |
| 4 | VERSION | 4 | VERSION |
| 5 | cgitrc.5 | ||
| 6 | cgitrc.5.fo | ||
| 7 | cgitrc.5.html | ||
| 8 | cgitrc.5.pdf | ||
| 9 | cgitrc.5.xml | ||
| 5 | *.o | 10 | *.o |
| 6 | *.d | 11 | *.d |
| @@ -5,7 +5,7 @@ CGIT_DATA_PATH = $(CGIT_SCRIPT_PATH) | |||
| 5 | CGIT_CONFIG = /etc/cgitrc | 5 | CGIT_CONFIG = /etc/cgitrc |
| 6 | CACHE_ROOT = /var/cache/cgit | 6 | CACHE_ROOT = /var/cache/cgit |
| 7 | SHA1_HEADER = <openssl/sha.h> | 7 | SHA1_HEADER = <openssl/sha.h> |
| 8 | GIT_VER = 1.6.1.1 | 8 | GIT_VER = 1.6.3.4 |
| 9 | GIT_URL = http://www.kernel.org/pub/software/scm/git/git-$(GIT_VER).tar.bz2 | 9 | GIT_URL = http://www.kernel.org/pub/software/scm/git/git-$(GIT_VER).tar.bz2 |
| 10 | INSTALL = install | 10 | INSTALL = install |
| 11 | 11 | ||
| @@ -100,7 +100,8 @@ ifdef NEEDS_LIBICONV | |||
| 100 | endif | 100 | endif |
| 101 | 101 | ||
| 102 | 102 | ||
| 103 | .PHONY: all libgit test install uninstall clean force-version get-git | 103 | .PHONY: all libgit test install uninstall clean force-version get-git \ |
| 104 | doc man-doc html-doc clean-doc | ||
| 104 | 105 | ||
| 105 | all: cgit | 106 | all: cgit |
| 106 | 107 | ||
| @@ -149,8 +150,22 @@ uninstall: | |||
| 149 | rm -f $(CGIT_DATA_PATH)/cgit.css | 150 | rm -f $(CGIT_DATA_PATH)/cgit.css |
| 150 | rm -f $(CGIT_DATA_PATH)/cgit.png | 151 | rm -f $(CGIT_DATA_PATH)/cgit.png |
| 151 | 152 | ||
| 152 | clean: | 153 | doc: man-doc html-doc pdf-doc |
| 154 | |||
| 155 | man-doc: cgitrc.5.txt | ||
| 156 | a2x -f manpage cgitrc.5.txt | ||
| 157 | |||
| 158 | html-doc: cgitrc.5.txt | ||
| 159 | a2x -f xhtml --stylesheet=cgit-doc.css cgitrc.5.txt | ||
| 160 | |||
| 161 | pdf-doc: cgitrc.5.txt | ||
| 162 | a2x -f pdf cgitrc.5.txt | ||
| 163 | |||
| 164 | clean: clean-doc | ||
| 153 | rm -f cgit VERSION *.o *.d | 165 | rm -f cgit VERSION *.o *.d |
| 154 | 166 | ||
| 167 | clean-doc: | ||
| 168 | rm -f cgitrc.5 cgitrc.5.html cgitrc.5.pdf cgitrc.5.xml cgitrc.5.fo | ||
| 169 | |||
| 155 | get-git: | 170 | get-git: |
| 156 | curl $(GIT_URL) | tar -xj && rm -rf git && mv git-$(GIT_VER) git | 171 | curl $(GIT_URL) | tar -xj && rm -rf git && mv git-$(GIT_VER) git |
diff --git a/cgit-doc.css b/cgit-doc.css new file mode 100644 index 0000000..5a399b6 --- /dev/null +++ b/cgit-doc.css | |||
| @@ -0,0 +1,3 @@ | |||
| 1 | div.variablelist dt { | ||
| 2 | margin-top: 1em; | ||
| 3 | } | ||
| @@ -17,6 +17,29 @@ | |||
| 17 | 17 | ||
| 18 | const char *cgit_version = CGIT_VERSION; | 18 | const char *cgit_version = CGIT_VERSION; |
| 19 | 19 | ||
| 20 | void add_mimetype(const char *name, const char *value) | ||
| 21 | { | ||
| 22 | struct string_list_item *item; | ||
| 23 | |||
| 24 | item = string_list_insert(xstrdup(name), &ctx.cfg.mimetypes); | ||
| 25 | item->util = xstrdup(value); | ||
| 26 | } | ||
| 27 | |||
| 28 | struct cgit_filter *new_filter(const char *cmd, int extra_args) | ||
| 29 | { | ||
| 30 | struct cgit_filter *f; | ||
| 31 | |||
| 32 | if (!cmd || !cmd[0]) | ||
| 33 | return NULL; | ||
| 34 | |||
| 35 | f = xmalloc(sizeof(struct cgit_filter)); | ||
| 36 | f->cmd = xstrdup(cmd); | ||
| 37 | f->argv = xmalloc((2 + extra_args) * sizeof(char *)); | ||
| 38 | f->argv[0] = f->cmd; | ||
| 39 | f->argv[1] = NULL; | ||
| 40 | return f; | ||
| 41 | } | ||
| 42 | |||
| 20 | void config_cb(const char *name, const char *value) | 43 | void config_cb(const char *name, const char *value) |
| 21 | { | 44 | { |
| 22 | if (!strcmp(name, "root-title")) | 45 | if (!strcmp(name, "root-title")) |
| @@ -31,6 +54,8 @@ void config_cb(const char *name, const char *value) | |||
| 31 | ctx.cfg.favicon = xstrdup(value); | 54 | ctx.cfg.favicon = xstrdup(value); |
| 32 | else if (!strcmp(name, "footer")) | 55 | else if (!strcmp(name, "footer")) |
| 33 | ctx.cfg.footer = xstrdup(value); | 56 | ctx.cfg.footer = xstrdup(value); |
| 57 | else if (!strcmp(name, "head-include")) | ||
| 58 | ctx.cfg.head_include = xstrdup(value); | ||
| 34 | else if (!strcmp(name, "header")) | 59 | else if (!strcmp(name, "header")) |
| 35 | ctx.cfg.header = xstrdup(value); | 60 | ctx.cfg.header = xstrdup(value); |
| 36 | else if (!strcmp(name, "logo")) | 61 | else if (!strcmp(name, "logo")) |
| @@ -49,6 +74,10 @@ void config_cb(const char *name, const char *value) | |||
| 49 | ctx.cfg.virtual_root = ""; | 74 | ctx.cfg.virtual_root = ""; |
| 50 | } else if (!strcmp(name, "nocache")) | 75 | } else if (!strcmp(name, "nocache")) |
| 51 | ctx.cfg.nocache = atoi(value); | 76 | ctx.cfg.nocache = atoi(value); |
| 77 | else if (!strcmp(name, "noplainemail")) | ||
| 78 | ctx.cfg.noplainemail = atoi(value); | ||
| 79 | else if (!strcmp(name, "noheader")) | ||
| 80 | ctx.cfg.noheader = atoi(value); | ||
| 52 | else if (!strcmp(name, "snapshots")) | 81 | else if (!strcmp(name, "snapshots")) |
| 53 | ctx.cfg.snapshots = cgit_parse_snapshots_mask(value); | 82 | ctx.cfg.snapshots = cgit_parse_snapshots_mask(value); |
| 54 | else if (!strcmp(name, "enable-index-links")) | 83 | else if (!strcmp(name, "enable-index-links")) |
| @@ -71,6 +100,12 @@ void config_cb(const char *name, const char *value) | |||
| 71 | ctx.cfg.cache_static_ttl = atoi(value); | 100 | ctx.cfg.cache_static_ttl = atoi(value); |
| 72 | else if (!strcmp(name, "cache-dynamic-ttl")) | 101 | else if (!strcmp(name, "cache-dynamic-ttl")) |
| 73 | ctx.cfg.cache_dynamic_ttl = atoi(value); | 102 | ctx.cfg.cache_dynamic_ttl = atoi(value); |
| 103 | else if (!strcmp(name, "about-filter")) | ||
| 104 | ctx.cfg.about_filter = new_filter(value, 0); | ||
| 105 | else if (!strcmp(name, "commit-filter")) | ||
| 106 | ctx.cfg.commit_filter = new_filter(value, 0); | ||
| 107 | else if (!strcmp(name, "embedded")) | ||
| 108 | ctx.cfg.embedded = atoi(value); | ||
| 74 | else if (!strcmp(name, "max-message-length")) | 109 | else if (!strcmp(name, "max-message-length")) |
| 75 | ctx.cfg.max_msg_len = atoi(value); | 110 | ctx.cfg.max_msg_len = atoi(value); |
| 76 | else if (!strcmp(name, "max-repodesc-length")) | 111 | else if (!strcmp(name, "max-repodesc-length")) |
| @@ -79,6 +114,8 @@ void config_cb(const char *name, const char *value) | |||
| 79 | ctx.cfg.max_repo_count = atoi(value); | 114 | ctx.cfg.max_repo_count = atoi(value); |
| 80 | else if (!strcmp(name, "max-commit-count")) | 115 | else if (!strcmp(name, "max-commit-count")) |
| 81 | ctx.cfg.max_commit_count = atoi(value); | 116 | ctx.cfg.max_commit_count = atoi(value); |
| 117 | else if (!strcmp(name, "source-filter")) | ||
| 118 | ctx.cfg.source_filter = new_filter(value, 1); | ||
| 82 | else if (!strcmp(name, "summary-log")) | 119 | else if (!strcmp(name, "summary-log")) |
| 83 | ctx.cfg.summary_log = atoi(value); | 120 | ctx.cfg.summary_log = atoi(value); |
| 84 | else if (!strcmp(name, "summary-branches")) | 121 | else if (!strcmp(name, "summary-branches")) |
| @@ -95,6 +132,8 @@ void config_cb(const char *name, const char *value) | |||
| 95 | ctx.cfg.clone_prefix = xstrdup(value); | 132 | ctx.cfg.clone_prefix = xstrdup(value); |
| 96 | else if (!strcmp(name, "local-time")) | 133 | else if (!strcmp(name, "local-time")) |
| 97 | ctx.cfg.local_time = atoi(value); | 134 | ctx.cfg.local_time = atoi(value); |
| 135 | else if (!prefixcmp(name, "mimetype.")) | ||
| 136 | add_mimetype(name + 9, value); | ||
| 98 | else if (!strcmp(name, "repo.group")) | 137 | else if (!strcmp(name, "repo.group")) |
| 99 | ctx.cfg.repo_group = xstrdup(value); | 138 | ctx.cfg.repo_group = xstrdup(value); |
| 100 | else if (!strcmp(name, "repo.url")) | 139 | else if (!strcmp(name, "repo.url")) |
| @@ -121,6 +160,12 @@ void config_cb(const char *name, const char *value) | |||
| 121 | ctx.repo->max_stats = cgit_find_stats_period(value, NULL); | 160 | ctx.repo->max_stats = cgit_find_stats_period(value, NULL); |
| 122 | else if (ctx.repo && !strcmp(name, "repo.module-link")) | 161 | else if (ctx.repo && !strcmp(name, "repo.module-link")) |
| 123 | ctx.repo->module_link= xstrdup(value); | 162 | ctx.repo->module_link= xstrdup(value); |
| 163 | else if (ctx.repo && !strcmp(name, "repo.about-filter")) | ||
| 164 | ctx.repo->about_filter = new_filter(value, 0); | ||
| 165 | else if (ctx.repo && !strcmp(name, "repo.commit-filter")) | ||
| 166 | ctx.repo->commit_filter = new_filter(value, 0); | ||
| 167 | else if (ctx.repo && !strcmp(name, "repo.source-filter")) | ||
| 168 | ctx.repo->source_filter = new_filter(value, 1); | ||
| 124 | else if (ctx.repo && !strcmp(name, "repo.readme") && value != NULL) { | 169 | else if (ctx.repo && !strcmp(name, "repo.readme") && value != NULL) { |
| 125 | if (*value == '/') | 170 | if (*value == '/') |
| 126 | ctx.repo->readme = xstrdup(value); | 171 | ctx.repo->readme = xstrdup(value); |
| @@ -173,6 +218,11 @@ static void querystring_cb(const char *name, const char *value) | |||
| 173 | } | 218 | } |
| 174 | } | 219 | } |
| 175 | 220 | ||
| 221 | char *xstrdupn(const char *str) | ||
| 222 | { | ||
| 223 | return (str ? xstrdup(str) : NULL); | ||
| 224 | } | ||
| 225 | |||
| 176 | static void prepare_context(struct cgit_context *ctx) | 226 | static void prepare_context(struct cgit_context *ctx) |
| 177 | { | 227 | { |
| 178 | memset(ctx, 0, sizeof(ctx)); | 228 | memset(ctx, 0, sizeof(ctx)); |
| @@ -186,7 +236,7 @@ static void prepare_context(struct cgit_context *ctx) | |||
| 186 | ctx->cfg.cache_root_ttl = 5; | 236 | ctx->cfg.cache_root_ttl = 5; |
| 187 | |||
