diff options
| -rw-r--r-- | Makefile | 22 | ||||
| -rw-r--r-- | cgit.c | 43 | ||||
| -rw-r--r-- | cgit.css | 119 | ||||
| -rw-r--r-- | cgit.h | 19 | ||||
| -rw-r--r-- | cgitrc.5.txt | 33 | ||||
| -rw-r--r-- | cmd.c | 48 | ||||
| -rw-r--r-- | cmd.h | 3 | ||||
| -rwxr-xr-x | filters/commit-links.sh | 16 | ||||
| -rwxr-xr-x | filters/syntax-highlighting.sh | 29 | ||||
| m--------- | git | 0 | ||||
| -rw-r--r-- | html.c | 70 | ||||
| -rw-r--r-- | html.h | 18 | ||||
| -rw-r--r-- | scan-tree.c | 2 | ||||
| -rw-r--r-- | shared.c | 88 | ||||
| -rw-r--r-- | ui-atom.c | 4 | ||||
| -rw-r--r-- | ui-commit.c | 31 | ||||
| -rw-r--r-- | ui-commit.h | 2 | ||||
| -rw-r--r-- | ui-diff.c | 92 | ||||
| -rw-r--r-- | ui-log.c | 41 | ||||
| -rw-r--r-- | ui-patch.c | 8 | ||||
| -rw-r--r-- | ui-patch.h | 2 | ||||
| -rw-r--r-- | ui-plain.c | 68 | ||||
| -rw-r--r-- | ui-refs.c | 4 | ||||
| -rw-r--r-- | ui-shared.c | 270 | ||||
| -rw-r--r-- | ui-shared.h | 71 | ||||
| -rw-r--r-- | ui-snapshot.c | 14 | ||||
| -rw-r--r-- | ui-ssdiff.c | 369 | ||||
| -rw-r--r-- | ui-ssdiff.h | 13 | ||||
| -rw-r--r-- | ui-tag.c | 24 | ||||
| -rw-r--r-- | ui-tree.c | 23 |
30 files changed, 1270 insertions, 276 deletions
| @@ -5,12 +5,15 @@ 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.4.3 | 8 | GIT_VER = 1.7.0 |
| 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 | ||
| 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 | # |
| 16 | 19 | ||
| @@ -68,7 +71,7 @@ endif | |||
| 68 | $(QUIET_CC)$(CC) -o $*.o -c $(CFLAGS) $< | 71 | $(QUIET_CC)$(CC) -o $*.o -c $(CFLAGS) $< |
| 69 | 72 | ||
| 70 | 73 | ||
| 71 | EXTLIBS = git/libgit.a git/xdiff/lib.a -lz -lcrypto | 74 | EXTLIBS = git/libgit.a git/xdiff/lib.a -lz |
| 72 | OBJECTS = | 75 | OBJECTS = |
| 73 | OBJECTS += cache.o | 76 | OBJECTS += cache.o |
| 74 | OBJECTS += cgit.o | 77 | OBJECTS += cgit.o |
| @@ -90,6 +93,7 @@ OBJECTS += ui-refs.o | |||
| 90 | OBJECTS += ui-repolist.o | 93 | OBJECTS += ui-repolist.o |
| 91 | OBJECTS += ui-shared.o | 94 | OBJECTS += ui-shared.o |
| 92 | OBJECTS += ui-snapshot.o | 95 | OBJECTS += ui-snapshot.o |
| 96 | OBJECTS += ui-ssdiff.o | ||
| 93 | OBJECTS += ui-stats.o | 97 | OBJECTS += ui-stats.o |
| 94 | OBJECTS += ui-summary.o | 98 | OBJECTS += ui-summary.o |
| 95 | OBJECTS += ui-tag.o | 99 | OBJECTS += ui-tag.o |
| @@ -123,17 +127,25 @@ endif | |||
| 123 | ifdef NO_STRCASESTR | 127 | ifdef NO_STRCASESTR |
| 124 | CFLAGS += -DNO_STRCASESTR | 128 | CFLAGS += -DNO_STRCASESTR |
| 125 | endif | 129 | endif |
| 130 | ifdef NO_OPENSSL | ||
| 131 | CFLAGS += -DNO_OPENSSL | ||
| 132 | GIT_OPTIONS += NO_OPENSSL=1 | ||
| 133 | else | ||
| 134 | EXTLIBS += -lcrypto | ||
| 135 | endif | ||
| 126 | 136 | ||
| 127 | cgit: $(OBJECTS) libgit | 137 | cgit: $(OBJECTS) libgit |
| 128 | $(QUIET_CC)$(CC) $(CFLAGS) $(LDFLAGS) -o cgit $(OBJECTS) $(EXTLIBS) | 138 | $(QUIET_CC)$(CC) $(CFLAGS) $(LDFLAGS) -o cgit $(OBJECTS) $(EXTLIBS) |
| 129 | 139 | ||
| 130 | cgit.o: VERSION | 140 | cgit.o: VERSION |
| 131 | 141 | ||
| 132 | -include $(OBJECTS:.o=.d) | 142 | ifneq "$(MAKECMDGOALS)" "clean" |
| 143 | -include $(OBJECTS:.o=.d) | ||
| 144 | endif | ||
| 133 | 145 | ||
| 134 | libgit: | 146 | libgit: |
| 135 | $(QUIET_SUBDIR0)git $(QUIET_SUBDIR1) NO_CURL=1 libgit.a | 147 | $(QUIET_SUBDIR0)git $(QUIET_SUBDIR1) NO_CURL=1 $(GIT_OPTIONS) libgit.a |
| 136 | $(QUIET_SUBDIR0)git $(QUIET_SUBDIR1) NO_CURL=1 xdiff/lib.a | 148 | $(QUIET_SUBDIR0)git $(QUIET_SUBDIR1) NO_CURL=1 $(GIT_OPTIONS) xdiff/lib.a |
| 137 | 149 | ||
| 138 | test: all | 150 | test: all |
| 139 | $(QUIET_SUBDIR0)tests $(QUIET_SUBDIR1) all | 151 | $(QUIET_SUBDIR0)tests $(QUIET_SUBDIR1) all |
| @@ -60,6 +60,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); | 60 | repo->enable_log_filecount = ctx.cfg.enable_log_filecount * atoi(value); |
| 61 | else if (!strcmp(name, "enable-log-linecount")) | 61 | else if (!strcmp(name, "enable-log-linecount")) |
| 62 | repo->enable_log_linecount = ctx.cfg.enable_log_linecount * atoi(value); | 62 | repo->enable_log_linecount = ctx.cfg.enable_log_linecount * atoi(value); |
| 63 | else if (!strcmp(name, "enable-remote-branches")) | ||
| 64 | repo->enable_remote_branches = atoi(value); | ||
| 65 | else if (!strcmp(name, "enable-subject-links")) | ||
| 66 | repo->enable_subject_links = atoi(value); | ||
| 63 | else if (!strcmp(name, "max-stats")) | 67 | else if (!strcmp(name, "max-stats")) |
| 64 | repo->max_stats = cgit_find_stats_period(value, NULL); | 68 | repo->max_stats = cgit_find_stats_period(value, NULL); |
| 65 | else if (!strcmp(name, "module-link")) | 69 | else if (!strcmp(name, "module-link")) |
| @@ -137,6 +141,10 @@ void config_cb(const char *name, const char *value) | |||
| 137 | ctx.cfg.enable_log_filecount = atoi(value); | 141 | ctx.cfg.enable_log_filecount = atoi(value); |
| 138 | else if (!strcmp(name, "enable-log-linecount")) | 142 | else if (!strcmp(name, "enable-log-linecount")) |
| 139 | ctx.cfg.enable_log_linecount = atoi(value); | 143 | ctx.cfg.enable_log_linecount = atoi(value); |
| 144 | else if (!strcmp(name, "enable-remote-branches")) | ||
| 145 | ctx.cfg.enable_remote_branches = atoi(value); | ||
| 146 | else if (!strcmp(name, "enable-subject-links")) | ||
| 147 | ctx.cfg.enable_subject_links = atoi(value); | ||
| 140 | else if (!strcmp(name, "enable-tree-linenumbers")) | 148 | else if (!strcmp(name, "enable-tree-linenumbers")) |
| 141 | ctx.cfg.enable_tree_linenumbers = atoi(value); | 149 | ctx.cfg.enable_tree_linenumbers = atoi(value); |
| 142 | else if (!strcmp(name, "max-stats")) | 150 | else if (!strcmp(name, "max-stats")) |
| @@ -144,7 +152,7 @@ void config_cb(const char *name, const char *value) | |||
| 144 | else if (!strcmp(name, "cache-size")) | 152 | else if (!strcmp(name, "cache-size")) |
| 145 | ctx.cfg.cache_size = atoi(value); | 153 | ctx.cfg.cache_size = atoi(value); |
| 146 | else if (!strcmp(name, "cache-root")) | 154 | else if (!strcmp(name, "cache-root")) |
| 147 | ctx.cfg.cache_root = xstrdup(value); | 155 | ctx.cfg.cache_root = xstrdup(expand_macros(value)); |
| 148 | else if (!strcmp(name, "cache-root-ttl")) | 156 | else if (!strcmp(name, "cache-root-ttl")) |
| 149 | ctx.cfg.cache_root_ttl = atoi(value); | 157 | ctx.cfg.cache_root_ttl = atoi(value); |
| 150 | else if (!strcmp(name, "cache-repo-ttl")) | 158 | else if (!strcmp(name, "cache-repo-ttl")) |
| @@ -161,19 +169,23 @@ void config_cb(const char *name, const char *value) | |||
| 161 | ctx.cfg.commit_filter = new_filter(value, 0); | 169 | ctx.cfg.commit_filter = new_filter(value, 0); |
| 162 | else if (!strcmp(name, "embedded")) | 170 | else if (!strcmp(name, "embedded")) |
| 163 | ctx.cfg.embedded = atoi(value); | 171 | ctx.cfg.embedded = atoi(value); |
| 172 | else if (!strcmp(name, "max-atom-items")) | ||
| 173 | ctx.cfg.max_atom_items = atoi(value); | ||
| 164 | else if (!strcmp(name, "max-message-length")) | 174 | else if (!strcmp(name, "max-message-length")) |
| 165 | ctx.cfg.max_msg_len = atoi(value); | 175 | ctx.cfg.max_msg_len = atoi(value); |
| 166 | else if (!strcmp(name, "max-repodesc-length")) | 176 | else if (!strcmp(name, "max-repodesc-length")) |
| 167 | ctx.cfg.max_repodesc_len = atoi(value); | 177 | ctx.cfg.max_repodesc_len = atoi(value); |
| 178 | else if (!strcmp(name, "max-blob-size")) | ||
| 179 | ctx.cfg.max_blob_size = atoi(value); | ||
| 168 | else if (!strcmp(name, "max-repo-count")) | 180 | else if (!strcmp(name, "max-repo-count")) |
| 169 | ctx.cfg.max_repo_count = atoi(value); | 181 | ctx.cfg.max_repo_count = atoi(value); |
| 170 | else if (!strcmp(name, "max-commit-count")) | 182 | else if (!strcmp(name, "max-commit-count")) |
| 171 | ctx.cfg.max_commit_count = atoi(value); | 183 | ctx.cfg.max_commit_count = atoi(value); |
| 172 | else if (!strcmp(name, "scan-path")) | 184 | else if (!strcmp(name, "scan-path")) |
| 173 | if (!ctx.cfg.nocache && ctx.cfg.cache_size) | 185 | if (!ctx.cfg.nocache && ctx.cfg.cache_size) |
| 174 | process_cached_repolist(value); | 186 | process_cached_repolist(expand_macros(value)); |
| 175 | else | 187 | else |
| 176 | scan_tree(value, repo_config); | 188 | scan_tree(expand_macros(value), repo_config); |
| 177 | else if (!strcmp(name, "source-filter")) | 189 | else if (!strcmp(name, "source-filter")) |
| 178 | ctx.cfg.source_filter = new_filter(value, 1); | 190 | ctx.cfg.source_filter = new_filter(value, 1); |
| 179 | else if (!strcmp(name, "summary-log")) | 191 | else if (!strcmp(name, "summary-log")) |
| @@ -182,6 +194,8 @@ void config_cb(const char *name, const char *value) | |||
| 182 | ctx.cfg.summary_branches = atoi(value); | 194 | ctx.cfg.summary_branches = atoi(value); |
| 183 | else if (!strcmp(name, "summary-tags")) | 195 | else if (!strcmp(name, "summary-tags")) |
| 184 | ctx.cfg.summary_tags = atoi(value); | 196 | ctx.cfg.summary_tags = atoi(value); |
| 197 | else if (!strcmp(name, "side-by-side-diffs")) | ||
| 198 | ctx.cfg.ssdiff = atoi(value); | ||
| 185 | else if (!strcmp(name, "agefile")) | 199 | else if (!strcmp(name, "agefile")) |
| 186 | ctx.cfg.agefile = xstrdup(value); | 200 | ctx.cfg.agefile = xstrdup(value); |
| 187 | else if (!strcmp(name, "renamelimit")) | 201 | else if (!strcmp(name, "renamelimit")) |
| @@ -195,7 +209,7 @@ void config_cb(const char *name, const char *value) | |||
| 195 | else if (!prefixcmp(name, "mimetype.")) | 209 | else if (!prefixcmp(name, "mimetype.")) |
| 196 | add_mimetype(name + 9, value); | 210 | add_mimetype(name + 9, value); |
| 197 | else if (!strcmp(name, "include")) | 211 | else if (!strcmp(name, "include")) |
| 198 | parse_configfile(value, config_cb); | 212 | parse_configfile(expand_macros(value), config_cb); |
| 199 | } | 213 | } |
| 200 | 214 | ||
| 201 | static void querystring_cb(const char *name, const char *value) | 215 | static void querystring_cb(const char *name, const char *value) |
| @@ -209,6 +223,8 @@ static void querystring_cb(const char *name, const char *value) | |||
| 209 | } else if (!strcmp(name, "p")) { | 223 | } else if (!strcmp(name, "p")) { |
| 210 | ctx.qry.page = xstrdup(value); | 224 | ctx.qry.page = xstrdup(value); |
| 211 | } else if (!strcmp(name, "url")) { | 225 | } else if (!strcmp(name, "url")) { |
| 226 | if (*value == '/') | ||
| 227 | value++; | ||
| 212 | ctx.qry.url = xstrdup(value); | 228 | ctx.qry.url = xstrdup(value); |
| 213 | cgit_parse_url(value); | 229 | cgit_parse_url(value); |
| 214 | } else if (!strcmp(name, "qt")) { | 230 | } else if (!strcmp(name, "qt")) { |
| @@ -238,6 +254,14 @@ static void querystring_cb(const char *name, const char *value) | |||
| 238 | ctx.qry.showmsg = atoi(value); | 254 | ctx.qry.showmsg = atoi(value); |
| 239 | } else if (!strcmp(name, "period")) { | 255 | } else if (!strcmp(name, "period")) { |
| 240 | ctx.qry.period = xstrdup(value); | 256 | ctx.qry.period = xstrdup(value); |
| 257 | } else if (!strcmp(name, "ss")) { | ||
| 258 | ctx.qry.ssdiff = atoi(value); | ||
| 259 | } else if (!strcmp(name, "all")) { | ||
| 260 | ctx.qry.show_all = atoi(value); | ||
| 261 | } else if (!strcmp(name, "context")) { | ||
| 262 | ctx.qry.context = atoi(value); | ||
| 263 | } else if (!strcmp(name, "ignorews")) { | ||
| 264 | ctx.qry.ignorews = atoi(value); | ||
| 241 | } | 265 | } |
| 242 | } | 266 | } |
| 243 | 267 | ||
| @@ -268,6 +292,7 @@ static void prepare_context(struct cgit_context *ctx) | |||
| 268 | ctx->cfg.max_lock_attempts = 5; | 292 | ctx->cfg.max_lock_attempts = 5; |
| 269 | ctx->cfg.max_msg_len = 80; | 293 | ctx->cfg.max_msg_len = 80; |
| 270 | ctx->cfg.max_repodesc_len = 80; | 294 | ctx->cfg.max_repodesc_len = 80; |
| 295 | ctx->cfg.max_blob_size = 0; | ||
| 271 | ctx->cfg.max_stats = 0; | 296 | ctx->cfg.max_stats = 0; |
| 272 | ctx->cfg.module_link = "./?repo=%s&page=commit&id=%s"; | 297 | ctx->cfg.module_link = "./?repo=%s&page=commit&id=%s"; |
| 273 | ctx->cfg.renamelimit = -1; | 298 | ctx->cfg.renamelimit = -1; |
| @@ -279,6 +304,8 @@ static void prepare_context(struct cgit_context *ctx) | |||
| 279 | ctx->cfg.summary_branches = 10; | 304 | ctx->cfg.summary_branches = 10; |
| 280 | ctx->cfg.summary_log = 10; | 305 | ctx->cfg.summary_log = 10; |
| 281 | ctx->cfg.summary_tags = 10; | 306 | ctx->cfg.summary_tags = 10; |
| 307 | ctx->cfg.max_atom_items = 10; | ||
| 308 | ctx->cfg.ssdiff = 0; | ||
| 282 | ctx->env.cgit_config = xstrdupn(getenv("CGIT_CONFIG")); | 309 | ctx->env.cgit_config = xstrdupn(getenv("CGIT_CONFIG")); |
| 283 | ctx->env.http_host = xstrdupn(getenv("HTTP_HOST")); | 310 | ctx->env.http_host = xstrdupn(getenv("HTTP_HOST")); |
| 284 | ctx->env.https = xstrdupn(getenv("HTTPS")); | 311 | ctx->env.https = xstrdupn(getenv("HTTPS")); |
| @@ -410,6 +437,12 @@ static void process_request(void *cbdata) | |||
| 410 | return; | 437 | return; |
| 411 | } | 438 | } |
| 412 | 439 | ||
| 440 | /* If cmd->want_vpath is set, assume ctx->qry.path contains a "virtual" | ||
| 441 | * in-project path limit to be made available at ctx->qry.vpath. | ||
| 442 | * Otherwise, no path limit is in effect (ctx->qry.vpath = NULL). | ||
| 443 | */ | ||
| 444 | ctx->qry.vpath = cmd->want_vpath ? ctx->qry.path : NULL; | ||
| 445 | |||
| 413 | if (cmd->want_repo && !ctx->repo) { | 446 | if (cmd->want_repo && !ctx->repo) { |
| 414 | cgit_print_http_headers(ctx); | 447 | cgit_print_http_headers(ctx); |
| 415 | cgit_print_docstart(ctx); | 448 | cgit_print_docstart(ctx); |
| @@ -674,7 +707,7 @@ int main(int argc, const char **argv) | |||
| 674 | cgit_repolist.repos = NULL; | 707 | cgit_repolist.repos = NULL; |
| 675 | 708 | ||
| 676 | cgit_parse_args(argc, argv); | 709 | cgit_parse_args(argc, argv); |
| 677 | parse_configfile(ctx.env.cgit_config, config_cb); | 710 | parse_configfile(expand_macros(ctx.env.cgit_config), config_cb); |
| 678 | ctx.repo = NULL; | 711 | ctx.repo = NULL; |
| 679 | http_parse_querystring(ctx.qry.raw, querystring_cb); | 712 | http_parse_querystring(ctx.qry.raw, querystring_cb); |
| 680 | 713 | ||
| @@ -64,7 +64,7 @@ table#header td.sub { | |||
| 64 | } | 64 | } |
| 65 | 65 | ||
| 66 | table.tabs { | 66 | table.tabs { |
| 67 | /* border-bottom: solid 2px #ccc; */ | 67 | border-bottom: solid 3px #ccc; |
| 68 | border-collapse: collapse; | 68 | border-collapse: collapse; |
| 69 | margin-top: 2em; | 69 | margin-top: 2em; |
| 70 | margin-bottom: 0px; | 70 | margin-bottom: 0px; |
| @@ -102,10 +102,16 @@ table.tabs td.form select { | |||
| 102 | font-size: 90%; | 102 | font-size: 90%; |
| 103 | } | 103 | } |
| 104 | 104 | ||
| 105 | div.path { | ||
| 106 | margin: 0px; | ||
| 107 | padding: 5px 2em 2px 2em; | ||
| 108 | color: #000; | ||
| 109 | background-color: #eee; | ||
| 110 | } | ||
| 111 | |||
| 105 | div.content { | 112 | div.content { |
| 106 | margin: 0px; | 113 | margin: 0px; |
| 107 | padding: 2em; | 114 | padding: 2em; |
| 108 | border-top: solid 3px #ccc; | ||
| 109 | border-bottom: solid 3px #ccc; | 115 | border-bottom: solid 3px #ccc; |
| 110 | } | 116 | } |
| 111 | 117 | ||
| @@ -162,6 +168,11 @@ table.list td a { | |||
| 162 | color: black; | 168 | color: black; |
| 163 | } | 169 | } |
| 164 | 170 | ||
| 171 | table.list td a.ls-dir { | ||
| 172 | font-weight: bold; | ||
| 173 | color: #00f; | ||
| 174 | } | ||
| 175 | |||
| 165 | table.list td a:hover { | 176 | table.list td a:hover { |
| 166 | color: #00f; | 177 | color: #00f; |
| 167 | } | 178 | } |
| @@ -520,7 +531,10 @@ a.deco { | |||
| 520 | border: solid 1px #770000; | 531 | border: solid 1px #770000; |
| 521 | } | 532 | } |
| 522 | 533 | ||
| 523 | div.commit-subject a { | 534 | div.commit-subject a.branch-deco, |
| 535 | div.commit-subject a.tag-deco, | ||
| 536 | div.commit-subject a.remote-deco, | ||
| 537 | div.commit-subject a.deco { | ||
| 524 | margin-left: 1em; | 538 | margin-left: 1em; |
| 525 | font-size: 75%; | 539 | font-size: 75%; |
| 526 | } | 540 | } |
| @@ -601,3 +615,102 @@ table.hgraph div.bar { | |||
| 601 | background-color: #eee; | 615 | background-color: #eee; |
| 602 | height: 1em; | 616 | height: 1em; |
| 603 | } | 617 | } |
| 618 | |||
| 619 | table.ssdiff { | ||
| 620 | width: 100%; | ||
| 621 | } | ||
| 622 | |||
| 623 | table.ssdiff td { | ||
| 624 | font-size: 75%; | ||
| 625 | font-family: monospace; | ||
| 626 | white-space: pre; | ||
| 627 | padding: 1px 4px 1px 4px; | ||
| 628 | border-left: solid 1px #aaa; | ||
| 629 | border-right: solid 1px #aaa; | ||
| 630 | } | ||
| 631 | |||
| 632 | table.ssdiff td.add { | ||
| 633 | color: black; | ||
| 634 | background: #cfc; | ||
| 635 | min-width: 50%; | ||
| 636 | } | ||
| 637 | |||
| 638 | table.ssdiff td.add_dark { | ||
| 639 | color: black; | ||
| 640 | background: #aca; | ||
| 641 | min-width: 50%; | ||
| 642 | } | ||
| 643 | |||
| 644 | table.ssdiff span.add { | ||
| 645 | background: #cfc; | ||
| 646 | font-weight: bold; | ||
| 647 | } | ||
| 648 | |||
| 649 | table.ssdiff td.del { | ||
| 650 | color: black; | ||
| 651 | background: #fcc; | ||
| 652 | min-width: 50%; | ||
| 653 | } | ||
| 654 | |||
| 655 | table.ssdiff td.del_dark { | ||
| 656 | color: black; | ||
| 657 | background: #caa; | ||
| 658 | min-width: 50%; | ||
| 659 | } | ||
| 660 | |||
| 661 | table.ssdiff span.del { | ||
| 662 | background: #fcc; | ||
| 663 | font-weight: bold; | ||
| 664 | } | ||
| 665 | |||
| 666 | table.ssdiff td.changed { | ||
| 667 | color: black; | ||
| 668 | background: #ffc; | ||
| 669 | min-width: 50%; | ||
| 670 | } | ||
| 671 | |||
| 672 | table.ssdiff td.changed_dark { | ||
| 673 | color: black; | ||
| 674 | background: #cca; | ||
| 675 | min-width: 50%; | ||
| 676 | } | ||
| 677 | |||
| 678 | table.ssdiff td.lineno { | ||
| 679 | color: black; | ||
| 680 | background: #eee; | ||
| 681 | text-align: right; | ||
| 682 | width: 3em; | ||
| 683 | min-width: 3em; | ||
| 684 | } | ||
| 685 | |||
| 686 | table.ssdiff td.hunk { | ||
| 687 | color: #black; | ||
| 688 | background: #ccf; | ||
| 689 | border-top: solid 1px #aaa; | ||
| 690 | border-bottom: solid 1px #aaa; | ||
| 691 | } | ||
| 692 | |||
| 693 | table.ssdiff td.head { | ||
| 694 | border-top: solid 1px #aaa; | ||
| 695 | border-bottom: solid 1px #aaa; | ||
| 696 | } | ||
| 697 | |||
| 698 | table.ssdiff td.head div.head { | ||
| 699 | font-weight: bold; | ||
| 700 | color: black; | ||
| 701 | } | ||
| 702 | |||
| 703 | table.ssdiff td.foot { | ||
| 704 | border-top: solid 1px #aaa; | ||
| 705 | border-left: none; | ||
| 706 | border-right: none; | ||
| 707 | border-bottom: none; | ||
| 708 | } | ||
| 709 | |||
| 710 | table.ssdiff td.space { | ||
| 711 | border: none; | ||
| 712 | } | ||
| 713 | |||
| 714 | table.ssdiff td.space div { | ||
| 715 | min-height: 3em; | ||
| 716 | } \ No newline at end of file | ||
| @@ -72,6 +72,8 @@ struct cgit_repo { | |||
| 72 | int snapshots; | 72 | int snapshots; |
| 73 | int enable_log_filecount; | 73 | int enable_log_filecount; |
| 74 | int enable_log_linecount; | 74 | int enable_log_linecount; |
| 75 | int enable_remote_branches; | ||
| 76 | int enable_subject_links; | ||
| 75 | int max_stats; | 77 | int max_stats; |
| 76 | time_t mtime; | 78 | time_t mtime; |
| 77 | struct cgit_filter *about_filter; | 79 | struct cgit_filter *about_filter; |
| @@ -143,6 +145,11 @@ struct cgit_query { | |||
| 143 | int nohead; | 145 | int nohead; |
| 144 | char *sort; | 146 | char *sort; |
| 145 | int showmsg; | 147 | int showmsg; |
| 148 | int ssdiff; | ||
| 149 | int show_all; | ||
| 150 | int context; | ||
| 151 | int ignorews; | ||
| 152 | char *vpath; | ||
| 146 | }; | 153 | }; |
| 147 | 154 | ||
| 148 | struct cgit_config { | 155 | struct cgit_config { |
| @@ -178,13 +185,17 @@ struct cgit_config { | |||
| 178 | int enable_index_links; | 185 | int enable_index_links; |
| 179 | int enable_log_filecount; | 186 | int enable_log_filecount; |
| 180 | int enable_log_linecount; | 187 | int enable_log_linecount; |
| 188 | int enable_remote_branches; | ||
| 189 | int enable_subject_links; | ||
| 181 | int enable_tree_linenumbers; | 190 | int enable_tree_linenumbers; |
| 182 | int local_time; | 191 | int local_time; |
| 192 | int max_atom_items; | ||
| 183 | int max_repo_count; | 193 | int max_repo_count; |
| 184 | int max_commit_count; | 194 | int max_commit_count; |
| 185 | int max_lock_attempts; | 195 | int max_lock_attempts; |
| 186 | int max_msg_len; | 196 | int max_msg_len; |
| 187 | int max_repodesc_len; | 197 | int max_repodesc_len; |
| 198 | int max_blob_size; | ||
| 188 | int max_stats; | 199 | int max_stats; |
| 189 | int nocache; | 200 | int nocache; |
| 190 | int noplainemail; | 201 | int noplainemail; |
| @@ -194,6 +205,7 @@ struct cgit_config { | |||
| 194 | int summary_branches; | 205 | int summary_branches; |
| 195 | int summary_log; | 206 | int summary_log; |
| 196 | int summary_tags; | 207 | int summary_tags; |
| 208 | int ssdiff; | ||
| 197 | struct string_list mimetypes; | 209 | struct string_list mimetypes; |
| 198 | struct cgit_filter *about_filter; | 210 | struct cgit_filter *about_filter; |
| 199 | struct cgit_filter *commit_filter; | 211 | struct cgit_filter *commit_filter; |
| @@ -268,11 +280,12 @@ extern void *cgit_free_commitinfo(struct commitinfo *info); | |||
| 268 | extern int cgit_diff_files(const unsigned char *old_sha1, | 280 | extern int cgit_diff_files(const unsigned char *old_sha1, |
| 269 | const unsigned char *new_sha1, | 281 | const unsigned char *new_sha1, |
| 270 | unsigned long *old_size, unsigned long *new_size, | 282 | unsigned long *old_size, unsigned long *new_size, |
| 271 | int *binary, linediff_fn fn); | 283 | int *binary, int context, int ignorews, |
| 284 | linediff_fn fn); | ||
| 272 | 285 | ||
| 273 | extern void cgit_diff_tree(const unsigned char *old_sha1, | 286 | extern void cgit_diff_tree(const unsigned char *old_sha1, |
| 274 | const unsigned char *new_sha1, | 287 | const unsigned char *new_sha1, |
| 275 | filepair_fn fn, const char *prefix); | 288 | filepair_fn fn, const char *prefix, int ignorews); |
| 276 | 289 | ||
| 277 | extern void cgit_diff_commit(struct commit *commit, filepair_fn fn); | 290 | extern void cgit_diff_commit(struct commit *commit, filepair_fn fn); |
| 278 | 291 | ||
| @@ -291,4 +304,6 @@ extern int cgit_close_filter(struct cgit_filter *filter); | |||
| 291 | 304 | ||
| 292 | extern int readfile(const char *path, char **buf, size_t *size); | 305 | extern int readfile(const char *path, char **buf, size_t *size); |
| 293 | 306 | ||
| 307 | extern char *expand_macros(const char *txt); | ||
| 308 | |||
| 294 | #endif /* CGIT_H */ | 309 | #endif /* CGIT_H */ |
diff --git a/cgitrc.5.txt b/cgitrc.5.txt index 0c13485..a853522 100644 --- a/cgitrc.5.txt +++ b/cgitrc.5.txt | |||
| @@ -110,6 +110,17 @@ enable-log-linecount:: | |||
| 110 | and removed lines for each commit on the repository log page. Default | 110 | and removed lines for each commit on the repository log page. Default |
| 111 | value: "0". | 111 | value: "0". |
| 112 | 112 | ||
| 113 | enable-remote-branches:: | ||
| 114 | Flag which, when set to "1", will make cgit display remote branches | ||
| 115 | in the summary and refs views. Default value: "0". See also: | ||
| 116 | "repo.enable-remote-branches". | ||
| 117 | |||
| 118 | enable-subject-links:: | ||
| 119 | Flag which, when set to "1", will make cgit use the subject of the | ||
| 120 | parent commit as link text when generating links to parent commits | ||
| 121 | in commit view. Default value: "0". See also: | ||
| 122 | "repo.enable-subject-links". | ||
| 123 | |||
| 113 | enable-tree-linenumbers:: | 124 | enable-tree-linenumbers:: |
| 114 | Flag which, when set to "1", will make cgit generate linenumber links | 125 | Flag which, when set to "1", will make cgit generate linenumber links |
| 115 | for plaintext blobs printed in the tree view. Default value: "1". | 126 | for plaintext blobs printed in the tree view. Default value: "1". |
| @@ -161,6 +172,10 @@ logo-link:: | |||
| 161 | calculated url of the repository index page will be used. Default | 172 | calculated url of the repository index page will be used. Default |
| 162 | value: none. | 173 | value: none. |
| 163 | 174 | ||
| 175 | max-atom-items:: | ||
| 176 | Specifies the number of items to display in atom feeds view. Default | ||
| 177 | value: "10". | ||
| 178 | |||
| 164 | max-commit-count:: | 179 | max-commit-count:: |
| 165 | Specifies the number of entries to list per page in "log" view. Default | 180 | Specifies the number of entries to list per page in "log" view. Default |
| 166 | value: "50". | 181 | value: "50". |
| @@ -177,6 +192,10 @@ max-repodesc-length:: | |||
| 177 | Specifies the maximum number of repo description characters to display | 192 | Specifies the maximum number of repo description characters to display |
| 178 | on the repository index page. Default value: "80". | 193 | on the repository index page. Default value: "80". |
| 179 | 194 | ||
| 195 | max-blob-size:: | ||
| 196 | Specifies the maximum size of a blob to display HTML for in KBytes. | ||
| 197 | Default value: "0" (limit disabled). | ||
| 198 | |||
| 180 | max-stats:: | 199 | max-stats:: |
| 181 | Set the default maximum statistics period. Valid values are "week", | 200 | Set the default maximum statistics period. Valid values are "week", |
| 182 | "month", "quarter" and "year". If unspecified, statistics are | 201 | "month", "quarter" and "year". If unspecified, statistics are |
| @@ -241,6 +260,10 @@ section:: | |||
| 241 | after this option will inherit the current section name. Default value: | 260 | after this option will inherit the current section name. Default value: |
| 242 | none. | 261 | none. |
| 243 | 262 | ||
| 263 | side-by-side-diffs:: | ||
| 264 | If set to "1" shows side-by-side diffs instead of unidiffs per | ||
| 265 | default. Default value: "0". | ||
| 266 | |||
| 244 | snapshots:: | 267 | snapshots:: |
| 245 | Text which specifies the default set of snapshot formats generated by | 268 | Text which specifies the default set of snapshot formats generated by |
| 246 | cgit. The value is a space-separated list of zero or more of the | 269 | cgit. The value is a space-separated list of zero or more of the |
| @@ -304,6 +327,14 @@ repo.enable-log-linecount:: | |||
| 304 | A flag which can be used to disable the global setting | 327 | A flag which can be used to disable the global setting |
| 305 | `enable-log-linecount'. Default value: none. | 328 | `enable-log-linecount'. Default value: none. |
| 306 | 329 | ||
| 330 | repo.enable-remote-branches:: | ||
| 331 | Flag which, when set to "1", will make cgit display remote branches | ||
| 332 | in the summary and refs views. Default value: <enable-remote-branches>. | ||
| 333 | |||
| 334 | repo.enable-subject-links:: | ||
| 335 | A flag which can be used to override the global setting | ||
| 336 | `enable-subject-links'. Default value: none. | ||
| 337 | |||
| 307 | repo.max-stats:: | 338 | repo.max-stats:: |
| 308 | Override the default maximum statistics period. Valid values are equal | 339 | Override the default maximum statistics period. Valid values are equal |
| 309 | to the values specified for the global "max-stats" setting. Default | 340 | to the values specified for the global "max-stats" setting. Default |
| @@ -413,7 +444,7 @@ snapshots=tar.gz tar.bz2 zip | |||
| 413 | ## List of common mimetypes | 444 | ## List of common mimetypes |
| 414 | ## | 445 | ## |
| 415 | 446 | ||
| 416 | mimetype.git=image/git | 447 | mimetype.gif=image/gif |
| 417 | mimetype.html=text/html | 448 | mimetype.html=text/html |
| 418 | mimetype.jpg=image/jpeg | 449 | mimetype.jpg=image/jpeg |
| 419 | mimetype.jpeg=image/jpeg | 450 | mimetype.jpeg=image/jpeg |
| @@ -33,7 +33,7 @@ static void HEAD_fn(struct cgit_context *ctx) | |||
| 33 | 33 | ||
| 34 | static void atom_fn(struct cgit_context *ctx) | 34 | static void atom_fn(struct cgit_context *ctx) |
| 35 | { | 35 | { |
| 36 | cgit_print_atom(ctx->qry.head, ctx->qry.path, 10); | 36 | cgit_print_atom(ctx->qry.head, ctx->qry.path, ctx->cfg.max_atom_items); |
| 37 | } | 37 | } |
| 38 | 38 | ||
| 39 | static void about_fn(struct cgit_context *ctx) | 39 | static void about_fn(struct cgit_context *ctx) |
| @@ -51,7 +51,7 @@ static void blob_fn(struct cgit_context *ctx) | |||
| 51 | 51 | ||
| 52 | static void commit_fn(struct cgit_context *ctx) | 52 | static void commit_fn(struct cgit_context *ctx) |
| 53 | { | 53 | { |
| 54 | cgit_print_commit(ctx->qry.sha1); | 54 | cgit_print_commit(ctx->qry.sha1, ctx->qry.path); |
| 55 | } | 55 | } |
| 56 | 56 | ||
| 57 | static void diff_fn(struct cgit_context *ctx) | 57 | static void diff_fn(struct cgit_context *ctx) |
| @@ -90,7 +90,7 @@ static void repolist_fn(struct cgit_context *ctx) | |||
| 90 | 90 | ||
| 91 | static void patch_fn(struct cgit_context *ctx) | 91 | static void patch_fn(struct cgit_context *ctx) |
| 92 | { | 92 | { |
| 93 | cgit_print_patch(ctx->qry.sha1); | 93 | cgit_print_patch(ctx->qry.sha1, ctx->qry.path); |
| 94 | } | 94 | } |
| 95 | 95 | ||
| 96 | static void plain_fn(struct cgit_context *ctx) | 96 | static void plain_fn(struct cgit_context *ctx) |
| @@ -129,31 +129,31 @@ static void tree_fn(struct cgit_context *ctx) | |||
| 129 | cgit_print_tree(ctx->qry.sha1, ctx->qry.path); | 129 | cgit_print_tree(ctx->qry.sha1, ctx->qry.path); |
| 130 | } | 130 | } |
| 131 | 131 | ||
| 132 | #define def_cmd(name, want_repo, want_layout) \ | 132 | #define def_cmd(name, want_repo, want_layout, want_vpath) \ |
| 133 | {#name, name##_fn, want_repo, want_layout} | 133 | {#name, name##_fn, want_repo, want_layout, want_vpath} |
| 134 | 134 | ||
| 135 | struct cgit_cmd *cgit_get_cmd(struct cgit_context *ctx) | 135 | struct cgit_cmd *cgit_get_cmd(struct cgit_context *ctx) |
| 136 | { | 136 | { |
| 137 | static struct cgit_cmd cmds[] = { | 137 | static struct cgit_cmd cmds[] = { |
| 138 | def_cmd(HEAD, 1, 0), | 138 | def_cmd(HEAD, 1, 0, 0), |
| 139 | def_cmd(atom, 1, 0), | 139 | def_cmd(atom, 1, 0, 0), |
| 140 | def_cmd(about, 0, 1), | 140 | def_cmd(about, 0, 1, 0), |
| 141 | def_cmd(blob, 1, 0), | 141 | def_cmd(blob, 1, 0, 0), |
| 142 | def_cmd(commit, 1, 1), | 142 | def_cmd(commit, 1, 1, 1), |
| 143 | def_cmd(diff, 1, 1), | 143 | def_cmd(diff, 1, 1, 1), |
| 144 | def_cmd(info, 1, 0), | 144 | def_cmd(info, 1, 0, 0), |
| 145 | def_cmd(log, 1, 1), | 145 | def_cmd(log, 1, 1, 1), |
| 146 | def_cmd(ls_cache, 0, 0), | 146 | def_cmd(ls_cache, 0, 0, 0), |
| 147 | def_cmd(objects, 1, 0), | 147 | def_cmd(objects, 1, 0, 0), |
| 148 | def_cmd(patch, 1, 0), | 148 | def_cmd(patch, 1, 0, 1), |
| 149 | def_cmd(plain, 1, 0), | 149 | def_cmd(plain, 1, 0, 0), |
| 150 | def_cmd(refs, 1, 1), | 150 | def_cmd(refs, 1, 1, 0), |
| 151 | def_cmd(repolist, 0, 0), | 151 | def_cmd(repolist, 0, 0, 0), |
| 152 | def_cmd(snapshot, 1, 0), | 152 | def_cmd(snapshot, 1, 0, 0), |
| 153 | def_cmd(stats, 1, 1), | 153 | def_cmd(stats, 1, 1, 1), |
| 154 | def_cmd(summary, 1, 1), | 154 | def_cmd(summary, 1, 1, 0), |
| 155 | def_cmd(tag, 1, 1), | 155 | def_cmd(tag, 1, 1, 0), |
| 156 | def_cmd(tree, 1, 1), | 156 | def_cmd(tree, 1, 1, 1), |
| 157 | }; | 157 | }; |
| 158 | int i; | 158 | int i; |
| 159 | 159 | ||
| @@ -7,7 +7,8 @@ struct cgit_cmd { | |||
| 7 | const char *name; | 7 | const char *name; |
| 8 | cgit_cmd_fn fn; | 8 | cgit_cmd_fn fn; |
| 9 | unsigned int want_repo:1, | 9 | unsigned int want_repo:1, |
| 10 | want_layout:1; | 10 | want_layout:1, |
| 11 | want_vpath:1; | ||
| 11 | }; | 12 | }; |
| 12 | 13 | ||
| 13 | extern struct cgit_cmd *cgit_get_cmd(struct cgit_context *ctx); | 14 | extern struct cgit_cmd *cgit_get_cmd(struct cgit_context *ctx); |
diff --git a/filters/commit-links.sh b/filters/commit-links.sh index 165a533..110c609 100755 --- a/filters/commit-links.sh +++ b/filters/commit-links.sh | |||
| @@ -1,12 +1,14 @@ | |||
| 1 | #!/bin/sh | 1 | #!/bin/sh |
| 2 | # This script can be used to generate links in commit messages - the first | ||
