From 2da46fe5aa7f18839238c37d9bcb63657f89be26 Mon Sep 17 00:00:00 2001 From: Lukas Fleischer Date: Tue, 27 Aug 2013 10:40:50 +0200 Subject: [PATCH 01/16] ui-diff: Use diff_tree_sha1() for raw diff formatting Use Git's internal diff_tree_sha1() function for the /rawdiff/ command instead of trying to recreate this functionality. Signed-off-by: Lukas Fleischer --- ui-diff.c | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/ui-diff.c b/ui-diff.c index 1209c47..7395c45 100644 --- a/ui-diff.c +++ b/ui-diff.c @@ -361,6 +361,7 @@ void cgit_print_diff(const char *new_rev, const char *old_rev, const char *prefix, int show_ctrls, int raw) { struct commit *commit, *commit2; + const unsigned char *old_tree_sha1, *new_tree_sha1; if (!new_rev) new_rev = ctx.qry.head; @@ -373,6 +374,7 @@ void cgit_print_diff(const char *new_rev, const char *old_rev, cgit_print_error("Bad commit: %s", sha1_to_hex(new_rev_sha1)); return; } + new_tree_sha1 = commit->tree->object.sha1; if (old_rev) { if (get_sha1(old_rev, old_rev_sha1)) { @@ -391,13 +393,30 @@ void cgit_print_diff(const char *new_rev, const char *old_rev, cgit_print_error("Bad commit: %s", sha1_to_hex(old_rev_sha1)); return; } + old_tree_sha1 = commit2->tree->object.sha1; + } else { + old_tree_sha1 = NULL; } if (raw) { + struct diff_options diffopt; + + diff_setup(&diffopt); + diffopt.output_format = DIFF_FORMAT_PATCH; + DIFF_OPT_SET(&diffopt, RECURSIVE); + diff_setup_done(&diffopt); + ctx.page.mimetype = "text/plain"; cgit_print_http_headers(&ctx); - cgit_diff_tree(old_rev_sha1, new_rev_sha1, filepair_cb_raw, - prefix, 0); + if (old_tree_sha1) { + diff_tree_sha1(old_tree_sha1, new_tree_sha1, "", + &diffopt); + } else { + diff_root_tree_sha1(new_tree_sha1, "", &diffopt); + } + diffcore_std(&diffopt); + diff_flush(&diffopt); + return; } -- 2.50.1 From d181d6593f827a524b9a7ebc860fa53410fddea2 Mon Sep 17 00:00:00 2001 From: Lukas Fleischer Date: Tue, 27 Aug 2013 10:40:51 +0200 Subject: [PATCH 02/16] ui-shared: Drop filepair_cb_raw() and helper Remove filepair_cb_raw() and all related functions. These are no longer needed. We now use Git's internal functions for raw diff formatting everywhere. Signed-off-by: Lukas Fleischer --- ui-shared.c | 72 ----------------------------------------------------- ui-shared.h | 1 - 2 files changed, 73 deletions(-) diff --git a/ui-shared.c b/ui-shared.c index 1e19421..7ab2ab1 100644 --- a/ui-shared.c +++ b/ui-shared.c @@ -950,75 +950,3 @@ void cgit_print_snapshot_links(const char *repo, const char *head, } strbuf_release(&filename); } - -static void print_line_raw(char *line, int len) -{ - char c = line[len-1]; - - line[len-1] = '\0'; - htmlf("%s\n", line); - line[len-1] = c; -} - -static void header_raw(unsigned char *sha1, char *path1, int mode1, - unsigned char *sha2, char *path2, int mode2) -{ - char *abbrev1, *abbrev2; - int subproject; - - subproject = (S_ISGITLINK(mode1) || S_ISGITLINK(mode2)); - htmlf("diff --git a/%s b/%s\n", path1, path2); - - if (mode1 == 0) - htmlf("new file mode %.6o\n", mode2); - - if (mode2 == 0) - htmlf("deleted file mode %.6o\n", mode1); - - if (!subproject) { - abbrev1 = xstrdup(find_unique_abbrev(sha1, DEFAULT_ABBREV)); - abbrev2 = xstrdup(find_unique_abbrev(sha2, DEFAULT_ABBREV)); - htmlf("index %s..%s", abbrev1, abbrev2); - free(abbrev1); - free(abbrev2); - if (mode1 != 0 && mode2 != 0) { - htmlf(" %.6o", mode1); - if (mode2 != mode1) - htmlf("..%.6o", mode2); - } - - if (is_null_sha1(sha1)) { - path1 = "dev/null"; - htmlf("\n--- /%s\n", path1); - } else - htmlf("\n--- a/%s\n", path1); - - if (is_null_sha1(sha2)) { - path2 = "dev/null"; - htmlf("+++ /%s\n", path2); - } else - htmlf("+++ b/%s\n", path2); - } -} - -void filepair_cb_raw(struct diff_filepair *pair) -{ - unsigned long old_size = 0; - unsigned long new_size = 0; - int binary = 0; - - header_raw(pair->one->sha1, pair->one->path, pair->one->mode, - pair->two->sha1, pair->two->path, pair->two->mode); - if (S_ISGITLINK(pair->one->mode) || S_ISGITLINK(pair->two->mode)) { - if (S_ISGITLINK(pair->one->mode)) - print_line_raw(fmt("-Subproject %s", sha1_to_hex(pair->one->sha1)), 52); - if (S_ISGITLINK(pair->two->mode)) - print_line_raw(fmt("+Subproject %s", sha1_to_hex(pair->two->sha1)), 52); - return; - } - if (cgit_diff_files(pair->one->sha1, pair->two->sha1, &old_size, - &new_size, &binary, 0, 0, print_line_raw)) - html("Error running diff"); - if (binary) - html("Binary files differ\n"); -} diff --git a/ui-shared.h b/ui-shared.h index a337dce..5987e77 100644 --- a/ui-shared.h +++ b/ui-shared.h @@ -67,5 +67,4 @@ extern void cgit_print_snapshot_links(const char *repo, const char *head, const char *hex, int snapshots); extern void cgit_add_hidden_formfields(int incl_head, int incl_search, const char *page); -extern void filepair_cb_raw(struct diff_filepair *pair); #endif /* UI_SHARED_H */ -- 2.50.1 From f7db9b5e37dec8c28e29a2cc9a2a4d179cbeded6 Mon Sep 17 00:00:00 2001 From: Lukas Fleischer Date: Fri, 22 Nov 2013 09:49:31 +0100 Subject: [PATCH 03/16] scan-tree.c: Remove unused macro This is no longer needed since commit fb3655df (use struct strbuf instead of static buffers, 2013-04-06). Signed-off-by: Lukas Fleischer --- scan-tree.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/scan-tree.c b/scan-tree.c index 7cd8f08..29c8263 100644 --- a/scan-tree.c +++ b/scan-tree.c @@ -230,8 +230,6 @@ end: closedir(dir); } -#define lastc(s) s[strlen(s) - 1] - void scan_projects(const char *path, const char *projectsfile, repo_config_fn fn) { struct strbuf line = STRBUF_INIT; -- 2.50.1 From e21da6c2a6ffcd8b4a2b2b06cf7486f36f291a5b Mon Sep 17 00:00:00 2001 From: Lukas Fleischer Date: Fri, 22 Nov 2013 09:50:17 +0100 Subject: [PATCH 04/16] ui-stats.c: Remove unused macro Signed-off-by: Lukas Fleischer --- ui-stats.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/ui-stats.c b/ui-stats.c index 28b794f..84b247c 100644 --- a/ui-stats.c +++ b/ui-stats.c @@ -9,8 +9,6 @@ #define SZ_FMT "%zu" #endif -#define MONTHS 6 - struct authorstat { long total; struct string_list list; -- 2.50.1 From 9973ef0207d21535a05610ca50d9f45c7c56c758 Mon Sep 17 00:00:00 2001 From: Lukas Fleischer Date: Fri, 22 Nov 2013 13:24:52 +0100 Subject: [PATCH 05/16] Use argv_array in place of vector Instead of using our own vector implementation, use argv_array from Git which has been specifically designed for dynamic size argv arrays. Drop vector.h and vector.c which are no longer needed. Signed-off-by: Lukas Fleischer --- cgit.mk | 1 - ui-log.c | 34 +++++++++++++++------------------- vector.c | 38 -------------------------------------- vector.h | 17 ----------------- 4 files changed, 15 insertions(+), 75 deletions(-) delete mode 100644 vector.c delete mode 100644 vector.h diff --git a/cgit.mk b/cgit.mk index 8af0041..b5cc7a2 100644 --- a/cgit.mk +++ b/cgit.mk @@ -50,7 +50,6 @@ CGIT_OBJ_NAMES += ui-stats.o CGIT_OBJ_NAMES += ui-summary.o CGIT_OBJ_NAMES += ui-tag.o CGIT_OBJ_NAMES += ui-tree.o -CGIT_OBJ_NAMES += vector.o CGIT_OBJS := $(addprefix $(CGIT_PREFIX),$(CGIT_OBJ_NAMES)) diff --git a/ui-log.c b/ui-log.c index 6f1249b..3c5130a 100644 --- a/ui-log.c +++ b/ui-log.c @@ -10,7 +10,7 @@ #include "ui-log.h" #include "html.h" #include "ui-shared.h" -#include "vector.h" +#include "argv-array.h" int files, add_lines, rem_lines; @@ -288,25 +288,25 @@ void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *pattern { struct rev_info rev; struct commit *commit; - struct vector vec = VECTOR_INIT(char *); + struct argv_array rev_argv = ARGV_ARRAY_INIT; int i, columns = commit_graph ? 4 : 3; int must_free_tip = 0; struct strbuf argbuf = STRBUF_INIT; - /* First argv is NULL */ - vector_push(&vec, NULL, 0); + /* rev_argv.argv[0] will be ignored by setup_revisions */ + argv_array_push(&rev_argv, "log_rev_setup"); if (!tip) tip = ctx.qry.head; tip = disambiguate_ref(tip, &must_free_tip); - vector_push(&vec, &tip, 0); + argv_array_push(&rev_argv, tip); if (grep && pattern && *pattern) { pattern = xstrdup(pattern); if (!strcmp(grep, "grep") || !strcmp(grep, "author") || !strcmp(grep, "committer")) { strbuf_addf(&argbuf, "--%s=%s", grep, pattern); - vector_push(&vec, &argbuf.buf, 0); + argv_array_push(&rev_argv, argbuf.buf); } if (!strcmp(grep, "range")) { char *arg; @@ -315,50 +315,46 @@ void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *pattern * rev-list options. Also, replace the previously * pushed tip (it's no longer relevant). */ - vec.count--; + argv_array_pop(&rev_argv); while ((arg = next_token(&pattern))) { if (*arg == '-') { fprintf(stderr, "Bad range expr: %s\n", arg); break; } - vector_push(&vec, &arg, 0); + argv_array_push(&rev_argv, arg); } } } if (commit_graph) { static const char *graph_arg = "--graph"; static const char *color_arg = "--color"; - vector_push(&vec, &graph_arg, 0); - vector_push(&vec, &color_arg, 0); + argv_array_push(&rev_argv, graph_arg); + argv_array_push(&rev_argv, color_arg); graph_set_column_colors(column_colors_html, COLUMN_COLORS_HTML_MAX); } if (commit_sort == 1) { static const char *date_order_arg = "--date-order"; - vector_push(&vec, &date_order_arg, 0); + argv_array_push(&rev_argv, date_order_arg); } else if (commit_sort == 2) { static const char *topo_order_arg = "--topo-order"; - vector_push(&vec, &topo_order_arg, 0); + argv_array_push(&rev_argv, topo_order_arg); } if (path) { static const char *double_dash_arg = "--"; - vector_push(&vec, &double_dash_arg, 0); - vector_push(&vec, &path, 0); + argv_array_push(&rev_argv, double_dash_arg); + argv_array_push(&rev_argv, path); } - /* Make sure the vector is NULL-terminated */ - vector_push(&vec, NULL, 0); - vec.count--; - init_revisions(&rev, NULL); rev.abbrev = DEFAULT_ABBREV; rev.commit_format = CMIT_FMT_DEFAULT; rev.verbose_header = 1; rev.show_root_diff = 0; - setup_revisions(vec.count, vec.data, &rev, NULL); + setup_revisions(rev_argv.argc, rev_argv.argv, &rev, NULL); load_ref_decorations(DECORATE_FULL_REFS); rev.show_decorations = 1; rev.grep_filter.regflags |= REG_ICASE; diff --git a/vector.c b/vector.c deleted file mode 100644 index 0863908..0000000 --- a/vector.c +++ /dev/null @@ -1,38 +0,0 @@ -#include -#include -#include -#include "vector.h" - -static int grow(struct vector *vec, int gently) -{ - size_t new_alloc; - void *new_data; - - new_alloc = vec->alloc * 3 / 2; - if (!new_alloc) - new_alloc = 8; - new_data = realloc(vec->data, new_alloc * vec->size); - if (!new_data) { - if (gently) - return ENOMEM; - perror("vector.c:grow()"); - exit(1); - } - vec->data = new_data; - vec->alloc = new_alloc; - return 0; -} - -int vector_push(struct vector *vec, const void *data, int gently) -{ - int rc; - - if (vec->count == vec->alloc && (rc = grow(vec, gently))) - return rc; - if (data) - memmove(vec->data + vec->count * vec->size, data, vec->size); - else - memset(vec->data + vec->count * vec->size, 0, vec->size); - vec->count++; - return 0; -} diff --git a/vector.h b/vector.h deleted file mode 100644 index c64eb1f..0000000 --- a/vector.h +++ /dev/null @@ -1,17 +0,0 @@ -#ifndef CGIT_VECTOR_H -#define CGIT_VECTOR_H - -#include - -struct vector { - size_t size; - size_t count; - size_t alloc; - void *data; -}; - -#define VECTOR_INIT(type) {sizeof(type), 0, 0, NULL} - -int vector_push(struct vector *vec, const void *data, int gently); - -#endif /* CGIT_VECTOR_H */ -- 2.50.1 From d76c438eada18cd3fd2980c9555f542cbe636479 Mon Sep 17 00:00:00 2001 From: Lukas Fleischer Date: Fri, 22 Nov 2013 13:30:58 +0100 Subject: [PATCH 06/16] ui-log.c: Several simplifications * Use argv_array_pushf() for inserting formatted strings. * Remove unneeded static strings. * Replace "if" by "else if" for readability and speed. Signed-off-by: Lukas Fleischer --- ui-log.c | 28 +++++++++------------------- 1 file changed, 9 insertions(+), 19 deletions(-) diff --git a/ui-log.c b/ui-log.c index 3c5130a..c154f69 100644 --- a/ui-log.c +++ b/ui-log.c @@ -291,7 +291,6 @@ void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *pattern struct argv_array rev_argv = ARGV_ARRAY_INIT; int i, columns = commit_graph ? 4 : 3; int must_free_tip = 0; - struct strbuf argbuf = STRBUF_INIT; /* rev_argv.argv[0] will be ignored by setup_revisions */ argv_array_push(&rev_argv, "log_rev_setup"); @@ -305,10 +304,8 @@ void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *pattern pattern = xstrdup(pattern); if (!strcmp(grep, "grep") || !strcmp(grep, "author") || !strcmp(grep, "committer")) { - strbuf_addf(&argbuf, "--%s=%s", grep, pattern); - argv_array_push(&rev_argv, argbuf.buf); - } - if (!strcmp(grep, "range")) { + argv_array_pushf(&rev_argv, "--%s=%s", grep, pattern); + } else if (!strcmp(grep, "range")) { char *arg; /* Split the pattern at whitespace and add each token * as a revision expression. Do not accept other @@ -327,25 +324,19 @@ void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *pattern } } if (commit_graph) { - static const char *graph_arg = "--graph"; - static const char *color_arg = "--color"; - argv_array_push(&rev_argv, graph_arg); - argv_array_push(&rev_argv, color_arg); + argv_array_push(&rev_argv, "--graph"); + argv_array_push(&rev_argv, "--color"); graph_set_column_colors(column_colors_html, COLUMN_COLORS_HTML_MAX); } - if (commit_sort == 1) { - static const char *date_order_arg = "--date-order"; - argv_array_push(&rev_argv, date_order_arg); - } else if (commit_sort == 2) { - static const char *topo_order_arg = "--topo-order"; - argv_array_push(&rev_argv, topo_order_arg); - } + if (commit_sort == 1) + argv_array_push(&rev_argv, "--date-order"); + else if (commit_sort == 2) + argv_array_push(&rev_argv, "--topo-order"); if (path) { - static const char *double_dash_arg = "--"; - argv_array_push(&rev_argv, double_dash_arg); + argv_array_push(&rev_argv, "--"); argv_array_push(&rev_argv, path); } @@ -437,5 +428,4 @@ void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *pattern /* If we allocated tip then it is safe to cast away const. */ if (must_free_tip) free((char*) tip); - strbuf_release(&argbuf); } -- 2.50.1 From 407f71cc061564d63b7358dd36a5bfebda05b15a Mon Sep 17 00:00:00 2001 From: John Keeping Date: Sun, 6 Oct 2013 12:14:41 +0100 Subject: [PATCH 07/16] plain: don't append charset for binary MIME types When outputting the Content-Type HTTP header we print the MIME type and then append "; charset=" if the charset variable is non-null. We don't want a charset when we have selected "application/octet-stream" or when the user has specified a custom MIME type, since they may have specified their own charset. To avoid this, make sure we set the page's charset to NULL in ui-plain before we generate the HTTP headers. Signed-off-by: John Keeping Signed-off-by: Lukas Fleischer --- ui-plain.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/ui-plain.c b/ui-plain.c index 9c86542..c9ec403 100644 --- a/ui-plain.c +++ b/ui-plain.c @@ -83,17 +83,22 @@ static int print_object(const unsigned char *sha1, const char *path) mime = string_list_lookup(&ctx.cfg.mimetypes, ext); if (mime) { ctx.page.mimetype = (char *)mime->util; + ctx.page.charset = NULL; } else { ctx.page.mimetype = get_mimetype_from_file(ctx.cfg.mimetype_file, ext); - if (ctx.page.mimetype) + if (ctx.page.mimetype) { freemime = 1; + ctx.page.charset = NULL; + } } } if (!ctx.page.mimetype) { - if (buffer_is_binary(buf, size)) + if (buffer_is_binary(buf, size)) { ctx.page.mimetype = "application/octet-stream"; - else + ctx.page.charset = NULL; + } else { ctx.page.mimetype = "text/plain"; + } } ctx.page.filename = path; ctx.page.size = size; -- 2.50.1 From 4468ec1b15becf3838d8cf38440c527c487565a4 Mon Sep 17 00:00:00 2001 From: Peter Wu Date: Thu, 3 Oct 2013 12:17:23 +0200 Subject: [PATCH 08/16] Reduce line number bloat, fix hover effect Currently line numbers look like (for blob view and sdiff respectively): 68 1 name=".." is unnecessary if the id attribute is set (this even applies to IE6), so drop it. (aside, in HTML5, the name attribute is gone.) The line number links can be selected through their parent classes, no need for another class "no", so drop it too. For a file with 2000 lines, this yields a saving of 40% (29% gzipped). While at it, fix the hover effect of line numbers: now the line number get a black background as was intended. Signed-off-by: Peter Wu Signed-off-by: Lukas Fleischer --- cgit.css | 6 ++++-- tests/t0104-tree.sh | 4 ++-- ui-ssdiff.c | 8 ++++---- ui-tree.c | 3 +-- 4 files changed, 11 insertions(+), 10 deletions(-) diff --git a/cgit.css b/cgit.css index d467c66..71b0b9b 100644 --- a/cgit.css +++ b/cgit.css @@ -291,13 +291,15 @@ div#cgit table.blob pre { padding: 0; margin: 0; } -div#cgit table.blob a.no, div#cgit table.ssdiff a.no { +div#cgit table.blob td.linenumbers a, +div#cgit table.ssdiff td.lineno a { color: gray; text-align: right; text-decoration: none; } -div#cgit table.blob a.no a:hover { +div#cgit table.blob td.linenumbers a:hover, +div#cgit table.ssdiff td.lineno a:hover { color: black; } diff --git a/tests/t0104-tree.sh b/tests/t0104-tree.sh index 100b026..2e140f5 100755 --- a/tests/t0104-tree.sh +++ b/tests/t0104-tree.sh @@ -10,11 +10,11 @@ test_expect_success 'find file-50' 'grep "file-50" tmp' test_expect_success 'generate bar/tree/file-50' 'cgit_url "bar/tree/file-50" >tmp' test_expect_success 'find line 1' ' - grep "1" tmp + grep "1" tmp ' test_expect_success 'no line 2' ' - ! grep "2" tmp + ! grep "2" tmp ' test_expect_success 'generate foo+bar/tree' 'cgit_url "foo%2bbar/tree" >tmp' diff --git a/ui-ssdiff.c b/ui-ssdiff.c index cbe60bd..08cf513 100644 --- a/ui-ssdiff.c +++ b/ui-ssdiff.c @@ -230,9 +230,9 @@ static void print_ssdiff_line(char *class, struct diff_filespec *old_file = cgit_get_current_old_file(); char *lineno_str = fmt("n%d", old_line_no); char *id_str = fmt("id=%s#%s", is_null_sha1(old_file->sha1)?"HEAD":sha1_to_hex(old_rev_sha1), lineno_str); - html("%s", lineno_str, lineno_str, lineno_str + 1); + htmlf("' id='%s'>%s", lineno_str, lineno_str + 1); html(""); htmlf("", class); } else if (old_line) @@ -251,9 +251,9 @@ static void print_ssdiff_line(char *class, struct diff_filespec *new_file = cgit_get_current_new_file(); char *lineno_str = fmt("n%d", new_line_no); char *id_str = fmt("id=%s#%s", is_null_sha1(new_file->sha1)?"HEAD":sha1_to_hex(new_rev_sha1), lineno_str); - html("%s", lineno_str, lineno_str, lineno_str + 1); + htmlf("' id='%s'>%s", lineno_str, lineno_str + 1); html(""); htmlf("", class); } else if (new_line) diff --git a/ui-tree.c b/ui-tree.c index aa5dee9..52b57b7 100644 --- a/ui-tree.c +++ b/ui-tree.c @@ -21,8 +21,7 @@ struct walk_tree_context { static void print_text_buffer(const char *name, char *buf, unsigned long size) { unsigned long lineno, idx; - const char *numberfmt = - "%1$d\n"; + const char *numberfmt = "%1$d\n"; html("\n"); -- 2.50.1 From 3cebf6838b0739caaf711255d4c3a397d1e3046a Mon Sep 17 00:00:00 2001 From: Christian Hesse Date: Thu, 28 Nov 2013 00:19:50 +0100 Subject: [PATCH 09/16] git: update to 1.8.5 Everything works just bumping the version in Makefile and commit hash in submodule. No code changes required. Signed-off-by: Lukas Fleischer --- Makefile | 2 +- git | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 82d5b58..9930570 100644 --- a/Makefile +++ b/Makefile @@ -14,7 +14,7 @@ htmldir = $(docdir) pdfdir = $(docdir) mandir = $(prefix)/share/man SHA1_HEADER = -GIT_VER = 1.8.4 +GIT_VER = 1.8.5 GIT_URL = https://git-core.googlecode.com/files/git-$(GIT_VER).tar.gz INSTALL = install COPYTREE = cp -r diff --git a/git b/git index e230c56..d2446df 160000 --- a/git +++ b/git @@ -1 +1 @@ -Subproject commit e230c568c4b9a991e3175e5f65171a566fd8e39c +Subproject commit d2446dfd7f3b3f8948142cfb07a0270e2497d93f -- 2.50.1 From f7f26f88755ac6a3b9af4918b51b0d6e7a692c78 Mon Sep 17 00:00:00 2001 From: Lukas Fleischer Date: Wed, 8 Jan 2014 15:10:49 +0100 Subject: [PATCH 10/16] Update copyright information * Name "cgit Development Team" as copyright holder to avoid listing every single developer. * Update copyright ranges. Signed-off-by: Lukas Fleischer --- cache.c | 2 +- cgit.c | 3 +-- cmd.c | 3 +-- configfile.c | 2 +- html.c | 2 +- parsing.c | 2 +- scan-tree.c | 5 ++--- shared.c | 2 +- ui-atom.c | 2 +- ui-blob.c | 3 +-- ui-clone.c | 2 +- ui-commit.c | 2 +- ui-diff.c | 2 +- ui-log.c | 2 +- ui-patch.c | 2 +- ui-plain.c | 2 +- ui-refs.c | 2 +- ui-repolist.c | 3 +-- ui-shared.c | 2 +- ui-snapshot.c | 3 +-- ui-summary.c | 3 +-- ui-tag.c | 2 +- ui-tree.c | 2 +- 23 files changed, 24 insertions(+), 31 deletions(-) diff --git a/cache.c b/cache.c index aa870e3..d339435 100644 --- a/cache.c +++ b/cache.c @@ -1,6 +1,6 @@ /* cache.c: cache management * - * Copyright (C) 2006 Lars Hjemli + * Copyright (C) 2006-2014 cgit Development Team * * Licensed under GNU General Public License v2 * (see COPYING for full license text) diff --git a/cgit.c b/cgit.c index 861352a..1f84da8 100644 --- a/cgit.c +++ b/cgit.c @@ -1,7 +1,6 @@ /* cgit.c: cgi for the git scm * - * Copyright (C) 2006 Lars Hjemli - * Copyright (C) 2010-2013 Jason A. Donenfeld + * Copyright (C) 2006-2014 cgit Development Team * * Licensed under GNU General Public License v2 * (see COPYING for full license text) diff --git a/cmd.c b/cmd.c index 0202917..420b3b1 100644 --- a/cmd.c +++ b/cmd.c @@ -1,7 +1,6 @@ /* cmd.c: the cgit command dispatcher * - * Copyright (C) 2008 Lars Hjemli - * Copyright (C) 2013 Jason A. Donenfeld . + * Copyright (C) 2006-2014 cgit Development Team * * Licensed under GNU General Public License v2 * (see COPYING for full license text) diff --git a/configfile.c b/configfile.c index 31fe5c8..833f158 100644 --- a/configfile.c +++ b/configfile.c @@ -1,6 +1,6 @@ /* configfile.c: parsing of config files * - * Copyright (C) 2008 Lars Hjemli + * Copyright (C) 2006-2014 cgit Development Team * * Licensed under GNU General Public License v2 * (see COPYING for full license text) diff --git a/html.c b/html.c index 03277db..903d4b7 100644 --- a/html.c +++ b/html.c @@ -1,6 +1,6 @@ /* html.c: helper functions for html output * - * Copyright (C) 2006 Lars Hjemli + * Copyright (C) 2006-2014 cgit Development Team * * Licensed under GNU General Public License v2 * (see COPYING for full license text) diff --git a/parsing.c b/parsing.c index 658621d..248b6ee 100644 --- a/parsing.c +++ b/parsing.c @@ -1,6 +1,6 @@ /* config.c: parsing of config files * - * Copyright (C) 2006 Lars Hjemli + * Copyright (C) 2006-2014 cgit Development Team * * Licensed under GNU General Public License v2 * (see COPYING for full license text) diff --git a/scan-tree.c b/scan-tree.c index 29c8263..1a2ea87 100644 --- a/scan-tree.c +++ b/scan-tree.c @@ -1,7 +1,6 @@ /* scan-tree.c - * - * Copyright (C) 2008-2009 Lars Hjemli - * Copyright (C) 2010-2013 Jason A. Donenfeld + * + * Copyright (C) 2006-2014 cgit Development Team * * Licensed under GNU General Public License v2 * (see COPYING for full license text) diff --git a/shared.c b/shared.c index 919a99e..c5c4b00 100644 --- a/shared.c +++ b/shared.c @@ -1,6 +1,6 @@ /* shared.c: global vars + some callback functions * - * Copyright (C) 2006 Lars Hjemli + * Copyright (C) 2006-2014 cgit Development Team * * Licensed under GNU General Public License v2 * (see COPYING for full license text) diff --git a/ui-atom.c b/ui-atom.c index 2a1eb59..838f220 100644 --- a/ui-atom.c +++ b/ui-atom.c @@ -1,6 +1,6 @@ /* ui-atom.c: functions for atom feeds * - * Copyright (C) 2008 Lars Hjemli + * Copyright (C) 2006-2014 cgit Development Team * * Licensed under GNU General Public License v2 * (see COPYING for full license text) diff --git a/ui-blob.c b/ui-blob.c index eb14a75..608926e 100644 --- a/ui-blob.c +++ b/ui-blob.c @@ -1,7 +1,6 @@ /* ui-blob.c: show blob content * - * Copyright (C) 2008 Lars Hjemli - * Copyright (C) 2010-2013 Jason A. Donenfeld + * Copyright (C) 2006-2014 cgit Development Team * * Licensed under GNU General Public License v2 * (see COPYING for full license text) diff --git a/ui-clone.c b/ui-clone.c index 30d020e..9d0d6ad 100644 --- a/ui-clone.c +++ b/ui-clone.c @@ -1,7 +1,7 @@ /* ui-clone.c: functions for http cloning, based on * git's http-backend.c by Shawn O. Pearce * - * Copyright (C) 2008 Lars Hjemli + * Copyright (C) 2006-2014 cgit Development Team * * Licensed under GNU General Public License v2 * (see COPYING for full license text) diff --git a/ui-commit.c b/ui-commit.c index ef85a49..aa1892f 100644 --- a/ui-commit.c +++ b/ui-commit.c @@ -1,6 +1,6 @@ /* ui-commit.c: generate commit view * - * Copyright (C) 2006 Lars Hjemli + * Copyright (C) 2006-2014 cgit Development Team * * Licensed under GNU General Public License v2 * (see COPYING for full license text) diff --git a/ui-diff.c b/ui-diff.c index 7395c45..5ccd03e 100644 --- a/ui-diff.c +++ b/ui-diff.c @@ -1,6 +1,6 @@ /* ui-diff.c: show diff between two blobs * - * Copyright (C) 2006 Lars Hjemli + * Copyright (C) 2006-2014 cgit Development Team * * Licensed under GNU General Public License v2 * (see COPYING for full license text) diff --git a/ui-log.c b/ui-log.c index c154f69..584336a 100644 --- a/ui-log.c +++ b/ui-log.c @@ -1,6 +1,6 @@ /* ui-log.c: functions for log output * - * Copyright (C) 2006 Lars Hjemli + * Copyright (C) 2006-2014 cgit Development Team * * Licensed under GNU General Public License v2 * (see COPYING for full license text) diff --git a/ui-patch.c b/ui-patch.c index 333bb99..3086608 100644 --- a/ui-patch.c +++ b/ui-patch.c @@ -1,6 +1,6 @@ /* ui-patch.c: generate patch view * - * Copyright (C) 2007 Lars Hjemli + * Copyright (C) 2006-2014 cgit Development Team * * Licensed under GNU General Public License v2 * (see COPYING for full license text) diff --git a/ui-plain.c b/ui-plain.c index c9ec403..68e0387 100644 --- a/ui-plain.c +++ b/ui-plain.c @@ -1,6 +1,6 @@ /* ui-plain.c: functions for output of plain blobs by path * - * Copyright (C) 2008 Lars Hjemli + * Copyright (C) 2006-2014 cgit Development Team * * Licensed under GNU General Public License v2 * (see COPYING for full license text) diff --git a/ui-refs.c b/ui-refs.c index 0ae0612..7af6fed 100644 --- a/ui-refs.c +++ b/ui-refs.c @@ -1,6 +1,6 @@ /* ui-refs.c: browse symbolic refs * - * Copyright (C) 2006 Lars Hjemli + * Copyright (C) 2006-2014 cgit Development Team * * Licensed under GNU General Public License v2 * (see COPYING for full license text) diff --git a/ui-repolist.c b/ui-repolist.c index 2ab6e9e..d4ee279 100644 --- a/ui-repolist.c +++ b/ui-repolist.c @@ -1,7 +1,6 @@ /* ui-repolist.c: functions for generating the repolist page * - * Copyright (C) 2006 Lars Hjemli - * Copyright (C) 2012 Jason A. Donenfeld + * Copyright (C) 2006-2014 cgit Development Team * * Licensed under GNU General Public License v2 * (see COPYING for full license text) diff --git a/ui-shared.c b/ui-shared.c index 7ab2ab1..d32852f 100644 --- a/ui-shared.c +++ b/ui-shared.c @@ -1,6 +1,6 @@ /* ui-shared.c: common web output functions * - * Copyright (C) 2006 Lars Hjemli + * Copyright (C) 2006-2014 cgit Development Team * * Licensed under GNU General Public License v2 * (see COPYING for full license text) diff --git a/ui-snapshot.c b/ui-snapshot.c index 42b7489..901c0c9 100644 --- a/ui-snapshot.c +++ b/ui-snapshot.c @@ -1,7 +1,6 @@ /* ui-snapshot.c: generate snapshot of a commit * - * Copyright (C) 2006 Lars Hjemli - * Copyright (C) 2012 Jason A. Donenfeld + * Copyright (C) 2006-2014 cgit Development Team * * Licensed under GNU General Public License v2 * (see COPYING for full license text) diff --git a/ui-summary.c b/ui-summary.c index 5598d08..3a7c7a7 100644 --- a/ui-summary.c +++ b/ui-summary.c @@ -1,7 +1,6 @@ /* ui-summary.c: functions for generating repo summary page * - * Copyright (C) 2006 Lars Hjemli - * Copyright (C) 2010-2013 Jason A. Donenfeld + * Copyright (C) 2006-2014 cgit Development Team * * Licensed under GNU General Public License v2 * (see COPYING for full license text) diff --git a/ui-tag.c b/ui-tag.c index aea7958..ec9c757 100644 --- a/ui-tag.c +++ b/ui-tag.c @@ -1,6 +1,6 @@ /* ui-tag.c: display a tag * - * Copyright (C) 2007 Lars Hjemli + * Copyright (C) 2006-2014 cgit Development Team * * Licensed under GNU General Public License v2 * (see COPYING for full license text) diff --git a/ui-tree.c b/ui-tree.c index 52b57b7..5ae3926 100644 --- a/ui-tree.c +++ b/ui-tree.c @@ -1,6 +1,6 @@ /* ui-tree.c: functions for tree output * - * Copyright (C) 2006 Lars Hjemli + * Copyright (C) 2006-2014 cgit Development Team * * Licensed under GNU General Public License v2 * (see COPYING for full license text) -- 2.50.1 From d350d34da963943db25469a8567c24e5e9ff1386 Mon Sep 17 00:00:00 2001 From: Lukas Fleischer Date: Wed, 8 Jan 2014 15:18:03 +0100 Subject: [PATCH 11/16] Add AUTHORS file Contains a list of contributors with more than 20 patches, to be updated regularly. Signed-off-by: Lukas Fleischer --- AUTHORS | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 AUTHORS diff --git a/AUTHORS b/AUTHORS new file mode 100644 index 0000000..c15a2ff --- /dev/null +++ b/AUTHORS @@ -0,0 +1,6 @@ +Jason A. Donenfeld +Lukas Fleischer +Johan Herland +Lars Hjemli +Ferry Huberts +John Keeping -- 2.50.1 From 09a28d761e1776329ec844916b72b8ae8c030e4b Mon Sep 17 00:00:00 2001 From: Ferry Huberts Date: Sat, 9 Nov 2013 20:34:55 +0100 Subject: [PATCH 12/16] filters: highlight.sh: add css comments for highlight 2.6 and 3.8 v2: add highlight 3.13 as present on Fedora 19 Signed-off-by: Ferry Huberts --- filters/syntax-highlighting.sh | 64 +++++++++++++++++++++++++++++++++- 1 file changed, 63 insertions(+), 1 deletion(-) diff --git a/filters/syntax-highlighting.sh b/filters/syntax-highlighting.sh index 24f6bb4..4fa7928 100755 --- a/filters/syntax-highlighting.sh +++ b/filters/syntax-highlighting.sh @@ -9,7 +9,9 @@ # # Note: the highlight command (http://www.andre-simon.de/) uses css for syntax # highlighting, so you'll probably want something like the following included -# in your css file (generated by highlight 2.4.8 and adapted for cgit): +# in your css file: +# +# Style definition file generated by highlight 2.4.8, http://www.andre-simon.de/ # # table.blob .num { color:#2928ff; } # table.blob .esc { color:#ff00ff; } @@ -24,6 +26,66 @@ # table.blob .kwc { color:#000000; font-weight:bold; } # table.blob .kwd { color:#010181; } # +# +# Style definition file generated by highlight 2.6.14, http://www.andre-simon.de/ +# +# body.hl { background-color:#ffffff; } +# pre.hl { color:#000000; background-color:#ffffff; font-size:10pt; font-family:'Courier New';} +# .hl.num { color:#2928ff; } +# .hl.esc { color:#ff00ff; } +# .hl.str { color:#ff0000; } +# .hl.dstr { color:#818100; } +# .hl.slc { color:#838183; font-style:italic; } +# .hl.com { color:#838183; font-style:italic; } +# .hl.dir { color:#008200; } +# .hl.sym { color:#000000; } +# .hl.line { color:#555555; } +# .hl.mark { background-color:#ffffbb;} +# .hl.kwa { color:#000000; font-weight:bold; } +# .hl.kwb { color:#830000; } +# .hl.kwc { color:#000000; font-weight:bold; } +# .hl.kwd { color:#010181; } +# +# +# Style definition file generated by highlight 3.8, http://www.andre-simon.de/ +# +# body.hl { background-color:#e0eaee; } +# pre.hl { color:#000000; background-color:#e0eaee; font-size:10pt; font-family:'Courier New';} +# .hl.num { color:#b07e00; } +# .hl.esc { color:#ff00ff; } +# .hl.str { color:#bf0303; } +# .hl.pps { color:#818100; } +# .hl.slc { color:#838183; font-style:italic; } +# .hl.com { color:#838183; font-style:italic; } +# .hl.ppc { color:#008200; } +# .hl.opt { color:#000000; } +# .hl.lin { color:#555555; } +# .hl.kwa { color:#000000; font-weight:bold; } +# .hl.kwb { color:#0057ae; } +# .hl.kwc { color:#000000; font-weight:bold; } +# .hl.kwd { color:#010181; } +# +# +# Style definition file generated by highlight 3.13, http://www.andre-simon.de/ +# +# body.hl { background-color:#e0eaee; } +# pre.hl { color:#000000; background-color:#e0eaee; font-size:10pt; font-family:'Courier New',monospace;} +# .hl.num { color:#b07e00; } +# .hl.esc { color:#ff00ff; } +# .hl.str { color:#bf0303; } +# .hl.pps { color:#818100; } +# .hl.slc { color:#838183; font-style:italic; } +# .hl.com { color:#838183; font-style:italic; } +# .hl.ppc { color:#008200; } +# .hl.opt { color:#000000; } +# .hl.ipl { color:#0057ae; } +# .hl.lin { color:#555555; } +# .hl.kwa { color:#000000; font-weight:bold; } +# .hl.kwb { color:#0057ae; } +# .hl.kwc { color:#000000; font-weight:bold; } +# .hl.kwd { color:#010181; } +# +# # The following environment variables can be used to retrieve the configuration # of the repository for which this script is called: # CGIT_REPO_URL ( = repo.url setting ) -- 2.50.1 From 88028ad5970cfb6333f5c9ffd9e05f6fd90fe486 Mon Sep 17 00:00:00 2001 From: =?utf8?q?P=C5=99emysl=20Janouch?= Date: Wed, 11 Sep 2013 20:10:10 +0200 Subject: [PATCH 13/16] Fix some spelling errors MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Přemysl Janouch --- cgitrc.5.txt | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/cgitrc.5.txt b/cgitrc.5.txt index 633cb00..07584ff 100644 --- a/cgitrc.5.txt +++ b/cgitrc.5.txt @@ -176,7 +176,7 @@ enable-git-config:: "scan-path", and must be defined prior, to augment repo-specific settings. The keys gitweb.owner, gitweb.category, and gitweb.description will map to the cgit keys repo.owner, repo.section, and repo.desc, - respectivly. All git config keys that begin with "cgit." will be mapped + respectively. All git config keys that begin with "cgit." will be mapped to the corresponding "repo." key in cgit. Default value: "0". See also: scan-path, section-from-path. @@ -592,8 +592,8 @@ environment variable will be unset. MACRO EXPANSION --------------- -The following cgitrc options supports a simple macro expansion feature, -where tokens prefixed with "$" are replaced with the value of a similary +The following cgitrc options support a simple macro expansion feature, +where tokens prefixed with "$" are replaced with the value of a similarly named environment variable: - cache-root @@ -620,7 +620,7 @@ EXAMPLE CGITRC FILE ------------------- .... -# Enable caching of up to 1000 output entriess +# Enable caching of up to 1000 output entries cache-size=1000 @@ -700,7 +700,7 @@ mimetype.png=image/png mimetype.svg=image/svg+xml -# Highlight source code with python pygments-based highligher +# Highlight source code with python pygments-based highlighter source-filter=/var/www/cgit/filters/syntax-highlighting.py # Format markdown, restructuredtext, manpages, text files, and html files -- 2.50.1 From f1fb521a0510cebb4971adf86de39d01cc316df2 Mon Sep 17 00:00:00 2001 From: =?utf8?q?P=C5=99emysl=20Janouch?= Date: Wed, 11 Sep 2013 20:10:11 +0200 Subject: [PATCH 14/16] Fix about-formatting.sh MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit dash failed to parse the script. Signed-off-by: Přemysl Janouch --- filters/about-formatting.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/filters/about-formatting.sh b/filters/about-formatting.sh index 313a4e6..892fbeb 100755 --- a/filters/about-formatting.sh +++ b/filters/about-formatting.sh @@ -18,7 +18,7 @@ # CGIT_REPO_CLONE_URL ( = repo.clone-url setting ) cd "$(dirname $0)/html-converters/" -case "$(tr '[:upper:]' '[:lower:]' <<<"$1")" in +case "$(printf '%s' "$1" | tr '[:upper:]' '[:lower:]')" in *.md|*.mkd) exec ./md2html; ;; *.rst) exec ./rst2html; ;; *.[1-9]) exec ./man2html; ;; -- 2.50.1 From 17e6a2af9d56be8da3ee197a446a1ac7eedae800 Mon Sep 17 00:00:00 2001 From: =?utf8?q?P=C5=99emysl=20Janouch?= Date: Wed, 11 Sep 2013 20:10:13 +0200 Subject: [PATCH 15/16] Fix the example configuration MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit "enable-git-clone" doesn't exist, replaced with "enable-http-clone". Signed-off-by: Přemysl Janouch --- cgitrc.5.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cgitrc.5.txt b/cgitrc.5.txt index 07584ff..2c48081 100644 --- a/cgitrc.5.txt +++ b/cgitrc.5.txt @@ -636,7 +636,7 @@ enable-index-owner=1 # Allow http transport git clone -enable-git-clone=1 +enable-http-clone=1 # Show extra links for each repository on the index page -- 2.50.1 From 4f6fb32f5881a093be4c2f41c72813b80404c569 Mon Sep 17 00:00:00 2001 From: =?utf8?q?P=C5=99emysl=20Janouch?= Date: Wed, 11 Sep 2013 20:10:14 +0200 Subject: [PATCH 16/16] Add a suggestion to the manpage MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit So that people wishing to use "enable-http-clone" don't have to find out the correct settings on their own. Signed-off-by: Přemysl Janouch --- cgitrc.5.txt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/cgitrc.5.txt b/cgitrc.5.txt index 2c48081..52caed0 100644 --- a/cgitrc.5.txt +++ b/cgitrc.5.txt @@ -133,8 +133,9 @@ enable-filter-overrides:: enable-http-clone:: If set to "1", cgit will act as an dumb HTTP endpoint for git clones. - If you use an alternate way of serving git repositories, you may wish - to disable this. Default value: "1". + You can add "http://$HTTP_HOST$SCRIPT_NAME/$CGIT_REPO_URL" to clone-url + to expose this feature. If you use an alternate way of serving git + repositories, you may wish to disable this. Default value: "1". enable-index-links:: Flag which, when set to "1", will make cgit generate extra links for -- 2.50.1