diff options
| -rw-r--r-- | Makefile | 18 | ||||
| -rw-r--r-- | cgit.c | 14 | ||||
| -rw-r--r-- | cgit.css | 104 | ||||
| -rw-r--r-- | cgit.h | 5 | ||||
| -rw-r--r-- | cgitrc.5.txt | 17 | ||||
| -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-- | shared.c | 1 | ||||
| -rw-r--r-- | ui-commit.c | 11 | ||||
| -rw-r--r-- | ui-diff.c | 62 | ||||
| -rw-r--r-- | ui-log.c | 4 | ||||
| -rw-r--r-- | ui-refs.c | 4 | ||||
| -rw-r--r-- | ui-shared.c | 43 | ||||
| -rw-r--r-- | ui-shared.h | 5 | ||||
| -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 | 8 |
21 files changed, 745 insertions, 88 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,6 +127,12 @@ 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) |
| @@ -132,8 +142,8 @@ cgit.o: VERSION | |||
| 132 | -include $(OBJECTS:.o=.d) | 142 | -include $(OBJECTS:.o=.d) |
| 133 | 143 | ||
| 134 | libgit: | 144 | libgit: |
| 135 | $(QUIET_SUBDIR0)git $(QUIET_SUBDIR1) NO_CURL=1 libgit.a | 145 | $(QUIET_SUBDIR0)git $(QUIET_SUBDIR1) NO_CURL=1 $(GIT_OPTIONS) libgit.a |
| 136 | $(QUIET_SUBDIR0)git $(QUIET_SUBDIR1) NO_CURL=1 xdiff/lib.a | 146 | $(QUIET_SUBDIR0)git $(QUIET_SUBDIR1) NO_CURL=1 $(GIT_OPTIONS) xdiff/lib.a |
| 137 | 147 | ||
| 138 | test: all | 148 | test: all |
| 139 | $(QUIET_SUBDIR0)tests $(QUIET_SUBDIR1) all | 149 | $(QUIET_SUBDIR0)tests $(QUIET_SUBDIR1) all |
| @@ -60,6 +60,8 @@ 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); | ||
| 63 | else if (!strcmp(name, "max-stats")) | 65 | else if (!strcmp(name, "max-stats")) |
| 64 | repo->max_stats = cgit_find_stats_period(value, NULL); | 66 | repo->max_stats = cgit_find_stats_period(value, NULL); |
| 65 | else if (!strcmp(name, "module-link")) | 67 | else if (!strcmp(name, "module-link")) |
| @@ -137,6 +139,8 @@ void config_cb(const char *name, const char *value) | |||
| 137 | ctx.cfg.enable_log_filecount = atoi(value); | 139 | ctx.cfg.enable_log_filecount = atoi(value); |
| 138 | else if (!strcmp(name, "enable-log-linecount")) | 140 | else if (!strcmp(name, "enable-log-linecount")) |
| 139 | ctx.cfg.enable_log_linecount = atoi(value); | 141 | ctx.cfg.enable_log_linecount = atoi(value); |
| 142 | else if (!strcmp(name, "enable-remote-branches")) | ||
| 143 | ctx.cfg.enable_remote_branches = atoi(value); | ||
| 140 | else if (!strcmp(name, "enable-tree-linenumbers")) | 144 | else if (!strcmp(name, "enable-tree-linenumbers")) |
| 141 | ctx.cfg.enable_tree_linenumbers = atoi(value); | 145 | ctx.cfg.enable_tree_linenumbers = atoi(value); |
| 142 | else if (!strcmp(name, "max-stats")) | 146 | else if (!strcmp(name, "max-stats")) |
| @@ -165,6 +169,8 @@ void config_cb(const char *name, const char *value) | |||
| 165 | ctx.cfg.max_msg_len = atoi(value); | 169 | ctx.cfg.max_msg_len = atoi(value); |
| 166 | else if (!strcmp(name, "max-repodesc-length")) | 170 | else if (!strcmp(name, "max-repodesc-length")) |
| 167 | ctx.cfg.max_repodesc_len = atoi(value); | 171 | ctx.cfg.max_repodesc_len = atoi(value); |
| 172 | else if (!strcmp(name, "max-blob-size")) | ||
| 173 | ctx.cfg.max_blob_size = atoi(value); | ||
| 168 | else if (!strcmp(name, "max-repo-count")) | 174 | else if (!strcmp(name, "max-repo-count")) |
| 169 | ctx.cfg.max_repo_count = atoi(value); | 175 | ctx.cfg.max_repo_count = atoi(value); |
| 170 | else if (!strcmp(name, "max-commit-count")) | 176 | else if (!strcmp(name, "max-commit-count")) |
| @@ -182,6 +188,8 @@ void config_cb(const char *name, const char *value) | |||
| 182 | ctx.cfg.summary_branches = atoi(value); | 188 | ctx.cfg.summary_branches = atoi(value); |
| 183 | else if (!strcmp(name, "summary-tags")) | 189 | else if (!strcmp(name, "summary-tags")) |
| 184 | ctx.cfg.summary_tags = atoi(value); | 190 | ctx.cfg.summary_tags = atoi(value); |
| 191 | else if (!strcmp(name, "side-by-side-diffs")) | ||
| 192 | ctx.cfg.ssdiff = atoi(value); | ||
| 185 | else if (!strcmp(name, "agefile")) | 193 | else if (!strcmp(name, "agefile")) |
| 186 | ctx.cfg.agefile = xstrdup(value); | 194 | ctx.cfg.agefile = xstrdup(value); |
| 187 | else if (!strcmp(name, "renamelimit")) | 195 | else if (!strcmp(name, "renamelimit")) |
| @@ -209,6 +217,8 @@ static void querystring_cb(const char *name, const char *value) | |||
| 209 | } else if (!strcmp(name, "p")) { | 217 | } else if (!strcmp(name, "p")) { |
| 210 | ctx.qry.page = xstrdup(value); | 218 | ctx.qry.page = xstrdup(value); |
| 211 | } else if (!strcmp(name, "url")) { | 219 | } else if (!strcmp(name, "url")) { |
| 220 | if (*value == '/') | ||
| 221 | value++; | ||
| 212 | ctx.qry.url = xstrdup(value); | 222 | ctx.qry.url = xstrdup(value); |
| 213 | cgit_parse_url(value); | 223 | cgit_parse_url(value); |
| 214 | } else if (!strcmp(name, "qt")) { | 224 | } else if (!strcmp(name, "qt")) { |
| @@ -238,6 +248,8 @@ static void querystring_cb(const char *name, const char *value) | |||
| 238 | ctx.qry.showmsg = atoi(value); | 248 | ctx.qry.showmsg = atoi(value); |
| 239 | } else if (!strcmp(name, "period")) { | 249 | } else if (!strcmp(name, "period")) { |
| 240 | ctx.qry.period = xstrdup(value); | 250 | ctx.qry.period = xstrdup(value); |
| 251 | } else if (!strcmp(name, "ss")) { | ||
| 252 | ctx.qry.ssdiff = atoi(value); | ||
| 241 | } | 253 | } |
| 242 | } | 254 | } |
| 243 | 255 | ||
| @@ -268,6 +280,7 @@ static void prepare_context(struct cgit_context *ctx) | |||
| 268 | ctx->cfg.max_lock_attempts = 5; | 280 | ctx->cfg.max_lock_attempts = 5; |
| 269 | ctx->cfg.max_msg_len = 80; | 281 | ctx->cfg.max_msg_len = 80; |
| 270 | ctx->cfg.max_repodesc_len = 80; | 282 | ctx->cfg.max_repodesc_len = 80; |
| 283 | ctx->cfg.max_blob_size = 0; | ||
| 271 | ctx->cfg.max_stats = 0; | 284 | ctx->cfg.max_stats = 0; |
| 272 | ctx->cfg.module_link = "./?repo=%s&page=commit&id=%s"; | 285 | ctx->cfg.module_link = "./?repo=%s&page=commit&id=%s"; |
| 273 | ctx->cfg.renamelimit = -1; | 286 | ctx->cfg.renamelimit = -1; |
| @@ -279,6 +292,7 @@ static void prepare_context(struct cgit_context *ctx) | |||
| 279 | ctx->cfg.summary_branches = 10; | 292 | ctx->cfg.summary_branches = 10; |
| 280 | ctx->cfg.summary_log = 10; | 293 | ctx->cfg.summary_log = 10; |
| 281 | ctx->cfg.summary_tags = 10; | 294 | ctx->cfg.summary_tags = 10; |
| 295 | ctx->cfg.ssdiff = 0; | ||
| 282 | ctx->env.cgit_config = xstrdupn(getenv("CGIT_CONFIG")); | 296 | ctx->env.cgit_config = xstrdupn(getenv("CGIT_CONFIG")); |
| 283 | ctx->env.http_host = xstrdupn(getenv("HTTP_HOST")); | 297 | ctx->env.http_host = xstrdupn(getenv("HTTP_HOST")); |
| 284 | ctx->env.https = xstrdupn(getenv("HTTPS")); | 298 | ctx->env.https = xstrdupn(getenv("HTTPS")); |
| @@ -162,6 +162,11 @@ table.list td a { | |||
| 162 | color: black; | 162 | color: black; |
| 163 | } | 163 | } |
| 164 | 164 | ||
| 165 | table.list td a.ls-dir { | ||
| 166 | font-weight: bold; | ||
| 167 | color: #00f; | ||
| 168 | } | ||
| 169 | |||
| 165 | table.list td a:hover { | 170 | table.list td a:hover { |
| 166 | color: #00f; | 171 | color: #00f; |
| 167 | } | 172 | } |
| @@ -601,3 +606,102 @@ table.hgraph div.bar { | |||
| 601 | background-color: #eee; | 606 | background-color: #eee; |
| 602 | height: 1em; | 607 | height: 1em; |
| 603 | } | 608 | } |
| 609 | |||
| 610 | table.ssdiff { | ||
| 611 | width: 100%; | ||
| 612 | } | ||
| 613 | |||
| 614 | table.ssdiff td { | ||
| 615 | font-size: 75%; | ||
| 616 | font-family: monospace; | ||
| 617 | white-space: pre; | ||
| 618 | padding: 1px 4px 1px 4px; | ||
| 619 | border-left: solid 1px #aaa; | ||
| 620 | border-right: solid 1px #aaa; | ||
| 621 | } | ||
| 622 | |||
| 623 | table.ssdiff td.add { | ||
| 624 | color: black; | ||
| 625 | background: #cfc; | ||
| 626 | min-width: 50%; | ||
| 627 | } | ||
| 628 | |||
| 629 | table.ssdiff td.add_dark { | ||
| 630 | color: black; | ||
| 631 | background: #aca; | ||
| 632 | min-width: 50%; | ||
| 633 | } | ||
| 634 | |||
| 635 | table.ssdiff span.add { | ||
| 636 | background: #cfc; | ||
| 637 | font-weight: bold; | ||
| 638 | } | ||
| 639 | |||
| 640 | table.ssdiff td.del { | ||
| 641 | color: black; | ||
| 642 | background: #fcc; | ||
| 643 | min-width: 50%; | ||
| 644 | } | ||
| 645 | |||
| 646 | table.ssdiff td.del_dark { | ||
| 647 | color: black; | ||
| 648 | background: #caa; | ||
| 649 | min-width: 50%; | ||
| 650 | } | ||
| 651 | |||
| 652 | table.ssdiff span.del { | ||
| 653 | background: #fcc; | ||
| 654 | font-weight: bold; | ||
| 655 | } | ||
| 656 | |||
| 657 | table.ssdiff td.changed { | ||
| 658 | color: black; | ||
| 659 | background: #ffc; | ||
| 660 | min-width: 50%; | ||
| 661 | } | ||
| 662 | |||
| 663 | table.ssdiff td.changed_dark { | ||
| 664 | color: black; | ||
| 665 | background: #cca; | ||
| 666 | min-width: 50%; | ||
| 667 | } | ||
| 668 | |||
| 669 | table.ssdiff td.lineno { | ||
| 670 | color: black; | ||
| 671 | background: #eee; | ||
| 672 | text-align: right; | ||
| 673 | width: 3em; | ||
| 674 | min-width: 3em; | ||
| 675 | } | ||
| 676 | |||
| 677 | table.ssdiff td.hunk { | ||
| 678 | color: #black; | ||
| 679 | background: #ccf; | ||
| 680 | border-top: solid 1px #aaa; | ||
| 681 | border-bottom: solid 1px #aaa; | ||
| 682 | } | ||
| 683 | |||
| 684 | table.ssdiff td.head { | ||
| 685 | border-top: solid 1px #aaa; | ||
| 686 | border-bottom: solid 1px #aaa; | ||
| 687 | } | ||
| 688 | |||
| 689 | table.ssdiff td.head div.head { | ||
| 690 | font-weight: bold; | ||
| 691 | color: black; | ||
| 692 | } | ||
| 693 | |||
| 694 | table.ssdiff td.foot { | ||
| 695 | border-top: solid 1px #aaa; | ||
| 696 | border-left: none; | ||
| 697 | border-right: none; | ||
| 698 | border-bottom: none; | ||
| 699 | } | ||
| 700 | |||
| 701 | table.ssdiff td.space { | ||
| 702 | border: none; | ||
| 703 | } | ||
