diff options
| -rw-r--r-- | Makefile | 18 | ||||
| -rw-r--r-- | cgit.c | 23 | ||||
| -rw-r--r-- | cgit.css | 104 | ||||
| -rw-r--r-- | cgit.h | 9 | ||||
| -rw-r--r-- | cgitrc.5.txt | 31 | ||||
| -rw-r--r-- | cmd.c | 2 | ||||
| -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 | 2 | ||||
| -rw-r--r-- | ui-atom.c | 4 | ||||
| -rw-r--r-- | ui-commit.c | 21 | ||||
| -rw-r--r-- | ui-diff.c | 62 | ||||
| -rw-r--r-- | ui-log.c | 4 | ||||
| -rw-r--r-- | ui-plain.c | 68 | ||||
| -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 |
25 files changed, 846 insertions, 101 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,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")) |
| @@ -161,10 +169,14 @@ 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")) |
| @@ -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")) |
| @@ -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,10 @@ 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); | ||
| 241 | } | 261 | } |
| 242 | } | 262 | } |
| 243 | 263 | ||
| @@ -268,6 +288,7 @@ static void prepare_context(struct cgit_context *ctx) | |||
| 268 | ctx->cfg.max_lock_attempts = 5; | 288 | ctx->cfg.max_lock_attempts = 5; |
| 269 | ctx->cfg.max_msg_len = 80; | 289 | ctx->cfg.max_msg_len = 80; |
| 270 | ctx->cfg.max_repodesc_len = 80; | 290 | ctx->cfg.max_repodesc_len = 80; |
| 291 | ctx->cfg.max_blob_size = 0; | ||
| 271 | ctx->cfg.max_stats = 0; | 292 | ctx->cfg.max_stats = 0; |
| 272 | ctx->cfg.module_link = "./?repo=%s&page=commit&id=%s"; | 293 | ctx->cfg.module_link = "./?repo=%s&page=commit&id=%s"; |
| 273 | ctx->cfg.renamelimit = -1; | 294 | ctx->cfg.renamelimit = -1; |
| @@ -279,6 +300,8 @@ static void prepare_context(struct cgit_context *ctx) | |||
| 279 | ctx->cfg.summary_branches = 10; | 300 | ctx->cfg.summary_branches = 10; |
| 280 | ctx->cfg.summary_log = 10; | 301 | ctx->cfg.summary_log = 10; |
| 281 | ctx->cfg.summary_tags = 10; | 302 | ctx->cfg.summary_tags = 10; |
| 303 | ctx->cfg.max_atom_items = 10; | ||
| 304 | ctx->cfg.ssdiff = 0; | ||
| 282 | ctx->env.cgit_config = xstrdupn(getenv("CGIT_CONFIG")); | 305 | ctx->env.cgit_config = xstrdupn(getenv("CGIT_CONFIG")); |
| 283 | ctx->env.http_host = xstrdupn(getenv("HTTP_HOST")); | 306 | ctx->env.http_host = xstrdupn(getenv("HTTP_HOST")); |
| 284 | ctx->env.https = xstrdupn(getenv("HTTPS")); | 307 | 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 | } | ||
| 704 | |||
| 705 | table.ssdiff td.space div { | ||
| 706 | min-height: 3em; | ||
| 707 | } \ 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,8 @@ 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; | ||
| 146 | }; | 150 | }; |
| 147 | 151 | ||
| 148 | struct cgit_config { | 152 | struct cgit_config { |
| @@ -178,13 +182,17 @@ struct cgit_config { | |||
| 178 | int enable_index_links; | 182 | int enable_index_links; |
| 179 | int enable_log_filecount; | 183 | int enable_log_filecount; |
| 180 | int enable_log_linecount; | 184 | int enable_log_linecount; |
| 185 | int enable_remote_branches; | ||
| 186 | int enable_subject_links; | ||
| 181 | int enable_tree_linenumbers; | 187 | int enable_tree_linenumbers; |
| 182 | int local_time; | 188 | int local_time; |
| 189 | int max_atom_items; | ||
| 183 | int max_repo_count; | 190 | int max_repo_count; |
| 184 | int max_commit_count; | 191 | int max_commit_count; |
| 185 | int max_lock_attempts; | 192 | int max_lock_attempts; |
| 186 | int max_msg_len; | 193 | int max_msg_len; |
| 187 | int max_repodesc_len; | 194 | int max_repodesc_len; |
| 195 | int max_blob_size; | ||
| 188 | int max_stats; | 196 | int max_stats; |
| 189 | int nocache; | 197 | int nocache; |
| 190 | int noplainemail; | 198 | int noplainemail; |
| @@ -194,6 +202,7 @@ struct cgit_config { | |||
| 194 | int summary_branches; | 202 | int summary_branches; |
| 195 | int summary_log; | 203 | int summary_log; |
| 196 | int summary_tags; | 204 | int summary_tags; |
| 205 | int ssdiff; | ||
| 197 | struct string_list mimetypes; | 206 | struct string_list mimetypes; |
| 198 | struct cgit_filter *about_filter; | 207 | struct cgit_filter *about_filter; |
| 199 | struct cgit_filter *commit_filter; | 208 | struct cgit_filter *commit_filter; |
diff --git a/cgitrc.5.txt b/cgitrc.5.txt index 0c13485..5c24381 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 |
| @@ -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) |
diff --git a/filters/syntax-highlighting.sh b/filters/syntax-highlighting.sh index 999ad0c..6b1c576 100755 --- a/filters/syntax-highlighting.sh +++ b/filters/syntax-highlighting.sh | |||
| @@ -3,6 +3,10 @@ | |||
| 3 | # tree-view by refering to this file with the source-filter or repo.source- | 3 | # tree-view by refering to this file with the source-filter or repo.source- |
| 4 | # filter options in cgitrc. | 4 | # filter options in cgitrc. |
| 5 | # | 5 | # |
| 6 | # This script requires a shell supporting the ${var##pattern} syntax. | ||
| 7 | # It is supported by at least dash and bash, however busybox environments | ||
| 8 | # might have to use an external call to sed instead. | ||
| 9 | # | ||
| 6 | # Note: the highlight command (http://www.andre-simon.de/) uses css for syntax | 10 | # Note: the highlight command (http://www.andre-simon.de/) uses css for syntax |
| 7 | # highlighting, so you'll probably want something like the following included | 11 | # highlighting, so you'll probably want something like the following included |
| 8 | # in your css file (generated by highlight 2.4.8 and adapted for cgit): | 12 | # in your css file (generated by highlight 2.4.8 and adapted for cgit): |
| @@ -20,20 +24,11 @@ | |||
| 20 | # table.blob .kwc { color:#000000; font-weight:bold; } | 24 | # table.blob .kwc { color:#000000; font-weight:bold; } |
| 21 | # table.blob .kwd { color:#010181; } | 25 | # table.blob .kwd { color:#010181; } |
| 22 | 26 | ||
| 23 | case "$1" in | 27 | # store filename and extension in local vars |
| 24 | *.c) | 28 | BASENAME="$1" |
| 25 | highlight -f -I -X -S c | 29 | EXTENSION="${BASENAME##*.}" |
| 26 | ;; | 30 | |
| 27 | *.h) | 31 | # map Makefile and Makefile.* to .mk |
| 28 | highlight -f -I -X -S c | 32 | [ "${BASENAME%%.*}" == "Makefile" ] && EXTENSION=mk |
| 29 | ;; | 33 | |
| 30 | *.sh) | 34 | exec highlight --force -f -I -X -S $EXTENSION 2>/dev/null |
| 31 | highlight -f -I -X -S sh | ||
| 32 | ;; | ||
| 33 | *.css) | ||
| 34 | highlight -f -I -X -S css | ||
| 35 | ;; | ||
| 36 | *) | ||
| 37 | highlight -f -I -X -S txt | ||
| 38 | ;; | ||
| 39 | esac | ||
diff --git a/git b/git | |||
| Subproject 7fb6bcff2dece2ff9fbc5ebfe526d9b2a7e764c | Subproject e923eaeb901ff056421b9007adcbbce271caa7b | ||
| @@ -13,6 +13,32 @@ | |||
| 13 | #include <string.h> | 13 | #include <string.h> |
| 14 | #include <errno.h> | 14 | #include <errno.h> |
| 15 | 15 | ||
| 16 | /* Percent-encoding of each character, except: a-zA-Z0-9!$()*,./:;@- */ | ||
| 17 | static const char* url_escape_table[256] = { | ||
| 18 | "%00", "%01", "%02", "%03", "%04", "%05", "%06", "%07", "%08", "%09", | ||
| 19 | "%0a", "%0b", "%0c", "%0d", "%0e", "%0f", "%10", "%11", "%12", "%13", | ||
| 20 | "%14", "%15", "%16", "%17", "%18", "%19", "%1a", "%1b", "%1c", "%1d", | ||
| 21 | "%1e", "%1f", "%20", 0, "%22", "%23", 0, "%25", "%26", "%27", 0, 0, 0, | ||
| 22 | "%2b", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "%3c", "%3d", | ||
| 23 | "%3e", "%3f", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | ||
| 24 | 0, 0, 0, 0, 0, 0, 0, 0, 0, "%5c", 0, "%5e", 0, "%60", 0, 0, 0, 0, 0, | ||
| 25 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "%7b", | ||
| 26 | "%7c", "%7d", 0, "%7f", "%80", "%81", "%82", "%83", "%84", "%85", | ||
| 27 | "%86", "%87", "%88", "%89", "%8a", "%8b", "%8c", "%8d", "%8e", "%8f", | ||
| 28 | "%90", "%91", "%92", "%93", "%94", "%95", "%96", "%97", "%98", "%99", | ||
| 29 | "%9a", "%9b", "%9c", "%9d", "%9e", "%9f", "%a0", "%a1", "%a2", "%a3", | ||
| 30 | "%a4", "%a5", "%a6", "%a7", "%a8", "%a9", "%aa", "%ab", "%ac", "%ad", | ||
| 31 | "%ae", "%af", "%b0", "%b1", "%b2", "%b3", "%b4", "%b5", "%b6", "%b7", | ||
| 32 | "%b8", "%b9", "%ba", "%bb", "%bc", "%bd", "%be", "%bf", "%c0", "%c1", | ||
| 33 | "%c2", "%c3", "%c4", "%c5", "%c6", "%c7", "%c8", "%c9", "%ca", "%cb", | ||
| 34 | "%cc", "%cd", "%ce", "%cf", "%d0", "%d1", "%d2", "%d3", "%d4", "%d5", | ||
| 35 | "%d6", "%d7", "%d8", "%d9", "%da", "%db", "%dc", "%dd", "%de", "%df", | ||
| 36 | "%e0", "%e1", "%e2", "%e3", "%e4", "%e5", "%e6", "%e7", "%e8", "%e9", | ||
| 37 | "%ea", "%eb", "%ec", "%ed", "%ee", "%ef", "%f0", "%f1", "%f2", "%f3", | ||
| 38 | "%f4", "%f5", "%f6", "%f7", "%f8", "%f9", "%fa", "%fb", "%fc", "%fd", | ||
| 39 | "%fe", "%ff" | ||
| 40 | }; | ||
| 41 | |||
| 16 | int htmlfd = STDOUT_FILENO; | 42 | int htmlfd = STDOUT_FILENO; |
| 17 | 43 | ||
| 18 | char *fmt(const char *format, ...) | 44 | char *fmt(const char *format, ...) |
| @@ -63,9 +89,9 @@ void html_status(int code, const char *msg, int more_headers) | |||
| 63 | html("\n"); | 89 | html("\n"); |
| 64 | } | 90 | } |
| 65 | 91 | ||
| 66 | void html_txt(char *txt) | 92 | void html_txt(const char *txt) |
| 67 | { | 93 | { |
| 68 | char *t = txt; | 94 | const char *t = txt; |
| 69 | while(t && *t){ | 95 | while(t && *t){ |
| 70 | int c = *t; | 96 | int c = *t; |
| 71 | if (c=='<' || c=='>' || c=='&') { | 97 | if (c=='<' || c=='>' || c=='&') { |
| @@ -84,9 +110,9 @@ void html_txt(char *txt) | |||
| 84 | html(txt); | 110 | html(txt); |
| 85 | } | 111 | } |
| 86 | 112 | ||
| 87 | void html_ntxt(int len, char *txt) | 113 | void html_ntxt(int len, const char *txt) |
| 88 | { | 114 | { |
| 89 | char *t = txt; | 115 | const char *t = txt; |
| 90 | while(t && *t && len--){ | 116 | while(t && *t && len--){ |
| 91 | int c = *t; | 117 | int c = *t; |
| 92 | if (c=='<' || c=='>' || c=='&') { | 118 | if (c=='<' || c=='>' || c=='&') { |
| @@ -107,9 +133,9 @@ void html_ntxt(int len, char *txt) | |||
| 107 | html("..."); | 133 | html("..."); |
| 108 | } | 134 | } |
| 109 | 135 | ||
| 110 | void html_attr(char *txt) | 136 | void html_attr(const char *txt) |
| 111 | { | 137 | { |
| 112 | char *t = txt; | 138 | const char *t = txt; |
| 113 | while(t && *t){ | 139 | while(t && *t){ |
| 114 | int c = *t; | 140 | int c = *t; |
| 115 | if (c=='<' || c=='>' || c=='\'' || c=='\"') { | 141 | if (c=='<' || c=='>' || c=='\'' || c=='\"') { |
| @@ -130,14 +156,15 @@ void html_attr(char *txt) | |||
| 130 | html(txt); | 156 | html(txt); |
| 131 | } | 157 | } |
| 132 | 158 | ||
| 133 | void html_url_path(char *txt) | 159 | void html_url_path(const char *txt) |
| 134 | { | 160 | { |
| 135 | char *t = txt; | 161 | const char *t = txt; |
| 136 | while(t && *t){ | 162 | while(t && *t){ |
| 137 | int c = *t; | 163 | int c = *t; |
| 138 | if (c=='"' || c=='#' || c=='\'' || c=='?') { | 164 | const char *e = url_escape_table[c]; |
| 165 | if (e && c!='+' && c!='&' && c!='+') { | ||
| 139 | write(htmlfd, txt, t - txt); | 166 | write(htmlfd, txt, t - txt); |
| 140 | write(htmlfd, fmt("%%%2x", c), 3); | 167 | write(htmlfd, e, 3); |
| 141 | txt = t+1; | 168 | txt = t+1; |
| 142 | } | 169 | } |
| 143 | t++; | 170 | t++; |
| @@ -146,14 +173,15 @@ void html_url_path(char *txt) | |||
| 146 | html(txt); | 173 | html(txt); |
| 147 | } | 174 | } |
| 148 | 175 | ||
| 149 | void html_url_arg(char *txt) | 176 | void html_url_arg(const char *txt) |
| 150 | { | 177 | { |
| 151 | char *t = txt; | 178 | const char *t = txt; |
| 152 | while(t && *t){ | 179 | while(t && *t){ |
| 153 | int c = *t; | 180 | int c = *t; |
| 154 | if (c=='"' || c=='#' || c=='%' || c=='&' || c=='\'' || c=='+' || c=='?') { | 181 | const char *e = url_escape_table[c]; |
| 182 | if (e) { | ||
| 155 | write(htmlfd, txt, t - txt); | 183 | write(htmlfd, txt, t - txt); |
| 156 | write(htmlfd, fmt("%%%2x", c), 3); | 184 | write(htmlfd, e, 3); |
| 157 | txt = t+1; | 185 | txt = t+1; |
| 158 | } | 186 | } |
| 159 | t++; | 187 | t++; |
| @@ -162,7 +190,7 @@ void html_url_arg(char *txt) | |||
| 162 | html(txt); | 190 | html(txt); |
| 163 | } | 191 | } |
| 164 | 192 | ||
| 165 | void html_hidden(char *name, char *value) | 193 | void html_hidden(const char *name, const char *value) |
| 166 | { | 194 | { |
| 167 | html("<input type='hidden' name='"); | 195 | html("<input type='hidden' name='"); |
| 168 | html_attr(name); | 196 | html_attr(name); |
| @@ -171,7 +199,7 @@ void html_hidden(char *name, char *value) | |||
| 171 | html("'/>"); | 199 | html("'/>"); |
| 172 | } | 200 | } |
| 173 | 201 | ||
| 174 | void html_option(char *value, char *text, char *selected_value) | 202 | void html_option(const char *value, const char *text, const char *selected_value) |
| 175 | { | 203 | { |
| 176 | html("<option value='"); | 204 | html("<option value='"); |
| 177 | html_attr(value); | 205 | html_attr(value); |
| @@ -183,7 +211,7 @@ void html_option(char *value, char *text, char *selected_value) | |||
| 183 | html("</option>\n"); | 211 | html("</option>\n"); |
| 184 | } | 212 | } |
| 185 | 213 | ||
| 186 | void html_link_open(char *url, char *title, char *class) | 214 | void html_link_open(const char *url, const char *title, const char *class) |
| 187 | { | 215 | { |
| 188 | html("<a href='"); | 216 | html("<a href='"); |
| 189 | html_attr(url); | 217 | html_attr(url); |
| @@ -257,14 +285,14 @@ char *convert_query_hexchar(char *txt) | |||
| 257 | } | 285 | } |
| 258 | } | 286 | } |
| 259 | 287 | ||
| 260 | int http_parse_querystring(char *txt, void (*fn)(const char *name, const char *value)) | 288 | int http_parse_querystring(const char *txt_, void (*fn)(const char *name, const char *value)) |
| 261 | { | 289 | { |
| 262 | char *t, *value = NULL, c; | 290 | char *t, *txt, *value = NULL, c; |
| 263 | 291 | ||
| 264 | if (!txt) | 292 | if (!txt_) |
| 265 | return 0; | 293 | return 0; |
| 266 | 294 | ||
| 267 | t = txt = strdup(txt); | 295 | t = txt = strdup(txt_); |
| 268 | if (t == NULL) { | 296 | if (t == NULL) { |
| 269 | printf("Out of memory\n"); | 297 | printf("Out of memory\n"); |
| 270 | exit(1); | 298 | exit(1); |
| @@ -7,18 +7,18 @@ extern void html_raw(const char *txt, size_t size); | |||
| 7 | extern void html(const char *txt); | 7 | extern void html(const char *txt); |
| 8 | extern void htmlf(const char *format,...); | 8 | extern void htmlf(const char *format,...); |
| 9 | extern void html_status(int code, const char *msg, int more_headers); | 9 | extern void html_status(int code, const char *msg, int more_headers); |
| 10 | extern void html_txt(char *txt); | 10 | extern void html_txt(const char *txt); |
| 11 | extern void html_ntxt(int len, char *txt); | 11 | extern void html_ntxt(int len, const char *txt); |
| 12 | extern void html_attr(char *txt); | 12 | extern void html_attr(const char *txt); |
| 13 | extern void html_url_path(char *txt); | 13 | extern void html_url_path(const char *txt); |
| 14 | extern void html_url_arg(char *txt); | 14 | extern void html_url_arg(const char *txt); |
| 15 | extern void html_hidden(char *name, char *value); | 15 | extern void html_hidden(const char *name, const char *value); |
| 16 | extern void html_option(char *value, char *text, char *selected_value); | 16 | extern void html_option(const char *value, const char *text, const char *selected_value); |
| 17 | extern void html_link_open(char *url, char *title, char *class); | 17 | extern void html_link_open(const char *url, const char *title, const char *class); |
| 18 | extern void html_link_close(void); | 18 | extern void html_link_close(void); |
| 19 | extern void html_fileperm(unsigned short mode); | 19 | extern void html_fileperm(unsigned short mode); |
| 20 | extern int html_include(const char *filename); | 20 | extern int html_include(const char *filename); |
| 21 | 21 | ||
| 22 | extern int http_parse_querystring(char *txt, void (*fn)(const char *name, const char *value)); | 22 | extern int http_parse_querystring(const char *txt, void (*fn)(const char *name, const char *value)); |
| 23 | 23 | ||
| 24 | #endif /* HTML_H */ | 24 | #endif /* HTML_H */ |
diff --git a/scan-tree.c b/scan-tree.c index dbca797..1e18f3c 100644 --- a/scan-tree.c +++ b/scan-tree.c | |||
| @@ -56,6 +56,8 @@ static void add_repo(const char *base, const char *path, repo_config_fn fn) | |||
| 56 | path, strerror(errno), errno); | 56 | path, strerror(errno), errno); |
| 57 | return; | 57 | return; |
| 58 | } | 58 | } |
| 59 | if (!stat(fmt("%s/noweb", path), &st)) | ||
| 60 | return; | ||
| 59 | if ((pwd = getpwuid(st.st_uid)) == NULL) { | 61 | if ((pwd = getpwuid(st.st_uid)) == NULL) { |
| 60 | fprintf(stderr, "Error reading owner-info for %s: %s (%d)\n", | 62 | fprintf(stderr, "Error reading owner-info for %s: %s (%d)\n", |
| 61 | path, strerror(errno), errno); | 63 | path, strerror(errno), errno); |
| @@ -59,6 +59,8 @@ struct cgit_repo *cgit_add_repo(const char *url) | |||
| 59 | ret->snapshots = ctx.cfg.snapshots; | 59 | ret->snapshots = ctx.cfg.snapshots; |
| 60 | ret->enable_log_filecount = ctx.cfg.enable_log_filecount; | 60 | ret->enable_log_filecount = ctx.cfg.enable_log_filecount; |
| 61 | ret->enable_log_linecount = ctx.cfg.enable_log_linecount; | 61 | ret->enable_log_linecount = ctx.cfg.enable_log_linecount; |
| 62 | ret->enable_remote_branches = ctx.cfg.enable_remote_branches; | ||
| 63 | ret->enable_subject_links = ctx.cfg.enable_subject_links; | ||
| 62 | ret->max_stats = ctx.cfg.max_stats; | 64 | ret->max_stats = ctx.cfg.max_stats; |
| 63 | ret->module_link = ctx.cfg.module_link; | 65 | ret->module_link = ctx.cfg.module_link; |
| 64 | ret->readme = NULL; | 66 | ret->readme = NULL; |
| @@ -85,7 +85,9 @@ void cgit_print_atom(char *tip, char *path, int max_count) | |||
| 85 | |||
