From b9ff119549f6018adc54c8447ad87943c6bcb55e Mon Sep 17 00:00:00 2001 From: June McEnroe Date: Tue, 17 May 2022 21:50:53 +0000 Subject: [PATCH 01/16] shared: fix bad free in cgit_diff_tree Since git commit 244c27242f44e6b88e3a381c90bde08d134c274b, > diff.[ch]: have diff_free() call clear_pathspec(opts.pathspec) calling diff_flush calls free(3) on opts.pathspec.items, so it can't be a pointer to a stack variable. Signed-off-by: Christian Hesse --- shared.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/shared.c b/shared.c index 8115469..0bceb98 100644 --- a/shared.c +++ b/shared.c @@ -341,9 +341,8 @@ void cgit_diff_tree(const struct object_id *old_oid, filepair_fn fn, const char *prefix, int ignorews) { struct diff_options opt; - struct pathspec_item item; + struct pathspec_item *item; - memset(&item, 0, sizeof(item)); diff_setup(&opt); opt.output_format = DIFF_FORMAT_CALLBACK; opt.detect_rename = 1; @@ -354,10 +353,11 @@ void cgit_diff_tree(const struct object_id *old_oid, opt.format_callback = cgit_diff_tree_cb; opt.format_callback_data = fn; if (prefix) { - item.match = xstrdup(prefix); - item.len = strlen(prefix); + item = xcalloc(1, sizeof(*item)); + item->match = xstrdup(prefix); + item->len = strlen(prefix); opt.pathspec.nr = 1; - opt.pathspec.items = &item; + opt.pathspec.items = item; } diff_setup_done(&opt); @@ -367,8 +367,6 @@ void cgit_diff_tree(const struct object_id *old_oid, diff_root_tree_oid(new_oid, "", &opt); diffcore_std(&opt); diff_flush(&opt); - - free(item.match); } void cgit_diff_commit(struct commit *commit, filepair_fn fn, const char *prefix) -- 2.50.1 From bcdfb2197facb8fcd4ec2283bda0905a9169fa45 Mon Sep 17 00:00:00 2001 From: Christian Hesse Date: Mon, 9 May 2022 09:29:05 +0200 Subject: [PATCH 02/16] git: update to v2.36.1 Update to git version v2.36.1, no additional changes required. Signed-off-by: Christian Hesse --- Makefile | 2 +- git | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 2509d21..93a61fd 100644 --- a/Makefile +++ b/Makefile @@ -14,7 +14,7 @@ htmldir = $(docdir) pdfdir = $(docdir) mandir = $(prefix)/share/man SHA1_HEADER = -GIT_VER = 2.36.0 +GIT_VER = 2.36.1 GIT_URL = https://www.kernel.org/pub/software/scm/git/git-$(GIT_VER).tar.xz INSTALL = install COPYTREE = cp -r diff --git a/git b/git index 6cd33dc..e54793a 160000 --- a/git +++ b/git @@ -1 +1 @@ -Subproject commit 6cd33dceed60949e2dbc32e3f0f5e67c4c882e1e +Subproject commit e54793a95afeea1e10de1e5ad7eab914e7416250 -- 2.50.1 From 2486d70752959f24f50a6399f15bfb9c7640a25b Mon Sep 17 00:00:00 2001 From: Christian Hesse Date: Tue, 14 Jun 2022 12:48:56 +0200 Subject: [PATCH 03/16] git: update to v2.37.0 Update to git version v2.37.0, no additional changes required. Signed-off-by: Christian Hesse --- Makefile | 2 +- git | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 93a61fd..b4e3f51 100644 --- a/Makefile +++ b/Makefile @@ -14,7 +14,7 @@ htmldir = $(docdir) pdfdir = $(docdir) mandir = $(prefix)/share/man SHA1_HEADER = -GIT_VER = 2.36.1 +GIT_VER = 2.37.0 GIT_URL = https://www.kernel.org/pub/software/scm/git/git-$(GIT_VER).tar.xz INSTALL = install COPYTREE = cp -r diff --git a/git b/git index e54793a..e4a4b31 160000 --- a/git +++ b/git @@ -1 +1 @@ -Subproject commit e54793a95afeea1e10de1e5ad7eab914e7416250 +Subproject commit e4a4b31577c7419497ac30cebe30d755b97752c5 -- 2.50.1 From 89ee51712233369e571daf75552166487d9ef9be Mon Sep 17 00:00:00 2001 From: Christian Hesse Date: Tue, 12 Jul 2022 21:16:29 +0200 Subject: [PATCH 04/16] git: update to v2.37.1 Update to git version v2.37.1, no additional changes required. Signed-off-by: Christian Hesse --- Makefile | 2 +- git | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index b4e3f51..09b0519 100644 --- a/Makefile +++ b/Makefile @@ -14,7 +14,7 @@ htmldir = $(docdir) pdfdir = $(docdir) mandir = $(prefix)/share/man SHA1_HEADER = -GIT_VER = 2.37.0 +GIT_VER = 2.37.1 GIT_URL = https://www.kernel.org/pub/software/scm/git/git-$(GIT_VER).tar.xz INSTALL = install COPYTREE = cp -r diff --git a/git b/git index e4a4b31..bbea4dc 160000 --- a/git +++ b/git @@ -1 +1 @@ -Subproject commit e4a4b31577c7419497ac30cebe30d755b97752c5 +Subproject commit bbea4dcf42b28eb7ce64a6306cdde875ae5d09ca -- 2.50.1 From 43df01c10feb1c7deace56e93a43a4fb93b55e27 Mon Sep 17 00:00:00 2001 From: Christian Hesse Date: Thu, 11 Aug 2022 22:07:02 +0200 Subject: [PATCH 05/16] git: update to v2.37.2 Update to git version v2.37.2, no additional changes required. Signed-off-by: Christian Hesse --- Makefile | 2 +- git | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 09b0519..bbd532c 100644 --- a/Makefile +++ b/Makefile @@ -14,7 +14,7 @@ htmldir = $(docdir) pdfdir = $(docdir) mandir = $(prefix)/share/man SHA1_HEADER = -GIT_VER = 2.37.1 +GIT_VER = 2.37.2 GIT_URL = https://www.kernel.org/pub/software/scm/git/git-$(GIT_VER).tar.xz INSTALL = install COPYTREE = cp -r diff --git a/git b/git index bbea4dc..ad60ddd 160000 --- a/git +++ b/git @@ -1 +1 @@ -Subproject commit bbea4dcf42b28eb7ce64a6306cdde875ae5d09ca +Subproject commit ad60dddad72dfb8367bd695028b5b8dc6c33661b -- 2.50.1 From e5c868f1098015b877c1c9a4581516bfab00e0a6 Mon Sep 17 00:00:00 2001 From: Christian Hesse Date: Tue, 30 Aug 2022 22:42:19 +0200 Subject: [PATCH 06/16] git: update to v2.37.3 Update to git version v2.37.3, no additional changes required. Signed-off-by: Christian Hesse --- Makefile | 2 +- git | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index bbd532c..6928e16 100644 --- a/Makefile +++ b/Makefile @@ -14,7 +14,7 @@ htmldir = $(docdir) pdfdir = $(docdir) mandir = $(prefix)/share/man SHA1_HEADER = -GIT_VER = 2.37.2 +GIT_VER = 2.37.3 GIT_URL = https://www.kernel.org/pub/software/scm/git/git-$(GIT_VER).tar.xz INSTALL = install COPYTREE = cp -r diff --git a/git b/git index ad60ddd..ac8035a 160000 --- a/git +++ b/git @@ -1 +1 @@ -Subproject commit ad60dddad72dfb8367bd695028b5b8dc6c33661b +Subproject commit ac8035a2affdf30f2c691ad760826d955bba0507 -- 2.50.1 From 33efb5fec5b8c6c6f3a02866514945d3d56867e7 Mon Sep 17 00:00:00 2001 From: Christian Hesse Date: Fri, 16 Sep 2022 11:31:24 +0200 Subject: [PATCH 07/16] git: update to v2.38.0 Update to git version v2.38.0, no additional changes required. Signed-off-by: Christian Hesse --- Makefile | 2 +- git | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 6928e16..e71be39 100644 --- a/Makefile +++ b/Makefile @@ -14,7 +14,7 @@ htmldir = $(docdir) pdfdir = $(docdir) mandir = $(prefix)/share/man SHA1_HEADER = -GIT_VER = 2.37.3 +GIT_VER = 2.38.0 GIT_URL = https://www.kernel.org/pub/software/scm/git/git-$(GIT_VER).tar.xz INSTALL = install COPYTREE = cp -r diff --git a/git b/git index ac8035a..3dcec76 160000 --- a/git +++ b/git @@ -1 +1 @@ -Subproject commit ac8035a2affdf30f2c691ad760826d955bba0507 +Subproject commit 3dcec76d9df911ed8321007b1d197c1a206dc164 -- 2.50.1 From 6ac984b51df06aae105054ce36e7d0f190564ccd Mon Sep 17 00:00:00 2001 From: Christian Hesse Date: Tue, 18 Oct 2022 21:22:41 +0200 Subject: [PATCH 08/16] git: update to v2.38.1 Update to git version v2.38.1, no additional changes required. Signed-off-by: Christian Hesse --- Makefile | 2 +- git | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index e71be39..414a724 100644 --- a/Makefile +++ b/Makefile @@ -14,7 +14,7 @@ htmldir = $(docdir) pdfdir = $(docdir) mandir = $(prefix)/share/man SHA1_HEADER = -GIT_VER = 2.38.0 +GIT_VER = 2.38.1 GIT_URL = https://www.kernel.org/pub/software/scm/git/git-$(GIT_VER).tar.xz INSTALL = install COPYTREE = cp -r diff --git a/git b/git index 3dcec76..d5b4139 160000 --- a/git +++ b/git @@ -1 +1 @@ -Subproject commit 3dcec76d9df911ed8321007b1d197c1a206dc164 +Subproject commit d5b41391a472dcf9486055fd5b8517f893e88daf -- 2.50.1 From 979cf4a753945ef5f3428693863d66eb33be7e2d Mon Sep 17 00:00:00 2001 From: Christian Hesse Date: Mon, 12 Dec 2022 16:18:28 +0100 Subject: [PATCH 09/16] git: update to v2.38.2 Update to git version v2.38.2, no additional changes required. Signed-off-by: Christian Hesse --- Makefile | 2 +- git | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 414a724..b9bdaf8 100644 --- a/Makefile +++ b/Makefile @@ -14,7 +14,7 @@ htmldir = $(docdir) pdfdir = $(docdir) mandir = $(prefix)/share/man SHA1_HEADER = -GIT_VER = 2.38.1 +GIT_VER = 2.38.2 GIT_URL = https://www.kernel.org/pub/software/scm/git/git-$(GIT_VER).tar.xz INSTALL = install COPYTREE = cp -r diff --git a/git b/git index d5b4139..8706a59 160000 --- a/git +++ b/git @@ -1 +1 @@ -Subproject commit d5b41391a472dcf9486055fd5b8517f893e88daf +Subproject commit 8706a59933d09354c5e3eb09a543453655a97183 -- 2.50.1 From e10159691e799d0f31f5314c73f47511cc974f46 Mon Sep 17 00:00:00 2001 From: Christian Hesse Date: Mon, 12 Dec 2022 16:21:23 +0100 Subject: [PATCH 10/16] git: update to v2.39.0 Update to git version v2.39.0, no additional changes required. Signed-off-by: Christian Hesse --- Makefile | 2 +- git | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index b9bdaf8..cd7639c 100644 --- a/Makefile +++ b/Makefile @@ -14,7 +14,7 @@ htmldir = $(docdir) pdfdir = $(docdir) mandir = $(prefix)/share/man SHA1_HEADER = -GIT_VER = 2.38.2 +GIT_VER = 2.39.0 GIT_URL = https://www.kernel.org/pub/software/scm/git/git-$(GIT_VER).tar.xz INSTALL = install COPYTREE = cp -r diff --git a/git b/git index 8706a59..c48035d 160000 --- a/git +++ b/git @@ -1 +1 @@ -Subproject commit 8706a59933d09354c5e3eb09a543453655a97183 +Subproject commit c48035d29b4e524aed3a32f0403676f0d9128863 -- 2.50.1 From cc6d9cc7fc010db9be6c2d90fd054fb2d189d629 Mon Sep 17 00:00:00 2001 From: June McEnroe Date: Wed, 18 Dec 2019 21:30:12 +0000 Subject: [PATCH 11/16] ui-tree,ui-blame: bail from blame if blob is binary This avoids piping binary blobs through the source-filter. Also prevent robots from crawling it, since it's expensive. Signed-off-by: Jason A. Donenfeld --- robots.txt | 1 + ui-blame.c | 4 ++++ ui-tree.c | 6 ++++-- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/robots.txt b/robots.txt index 4ce948f..1b33266 100644 --- a/robots.txt +++ b/robots.txt @@ -1,3 +1,4 @@ User-agent: * Disallow: /*/snapshot/* +Disallow: /*/blame/* Allow: / diff --git a/ui-blame.c b/ui-blame.c index 03136f7..4adec2b 100644 --- a/ui-blame.c +++ b/ui-blame.c @@ -152,6 +152,10 @@ static void print_object(const struct object_id *oid, const char *path, cgit_tree_link("tree", NULL, NULL, ctx.qry.head, rev, path); html(")\n"); + if (buffer_is_binary(buf, size)) { + html("
blob is binary.
"); + goto cleanup; + } if (ctx.cfg.max_blob_size && size / 1024 > ctx.cfg.max_blob_size) { htmlf("
blob size (%ldKB)" " exceeds display size limit (%dKB).
", diff --git a/ui-tree.c b/ui-tree.c index b61f6f5..034c4c8 100644 --- a/ui-tree.c +++ b/ui-tree.c @@ -89,6 +89,7 @@ static void print_object(const struct object_id *oid, const char *path, const ch enum object_type type; char *buf; unsigned long size; + bool is_binary; type = oid_object_info(the_repository, oid, &size); if (type == OBJ_BAD) { @@ -103,6 +104,7 @@ static void print_object(const struct object_id *oid, const char *path, const ch "Error reading object %s", oid_to_hex(oid)); return; } + is_binary = buffer_is_binary(buf, size); cgit_set_title_from_path(path); @@ -110,7 +112,7 @@ static void print_object(const struct object_id *oid, const char *path, const ch htmlf("blob: %s (", oid_to_hex(oid)); cgit_plain_link("plain", NULL, NULL, ctx.qry.head, rev, path); - if (ctx.repo->enable_blame) { + if (ctx.repo->enable_blame && !is_binary) { html(") ("); cgit_blame_link("blame", NULL, NULL, ctx.qry.head, rev, path); @@ -123,7 +125,7 @@ static void print_object(const struct object_id *oid, const char *path, const ch return; } - if (buffer_is_binary(buf, size)) + if (is_binary) print_binary_buffer(buf, size); else print_text_buffer(basename, buf, size); -- 2.50.1 From bcffc523669e00abd949778d4defce37532a3855 Mon Sep 17 00:00:00 2001 From: June McEnroe Date: Thu, 19 Dec 2019 21:55:05 +0000 Subject: [PATCH 12/16] ui-tree: show symlink targets in tree listing Add links to symbolic link targets in tree listings, formatted like "ls -l". Path normalization collapses any ".." components of the link. Also fix up memory link on error path. Signed-off-by: Jason A. Donenfeld --- ui-tree.c | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/ui-tree.c b/ui-tree.c index 034c4c8..98ce1ca 100644 --- a/ui-tree.c +++ b/ui-tree.c @@ -204,9 +204,11 @@ static int ls_item(const struct object_id *oid, struct strbuf *base, struct walk_tree_context *walk_tree_ctx = cbdata; char *name; struct strbuf fullpath = STRBUF_INIT; + struct strbuf linkpath = STRBUF_INIT; struct strbuf class = STRBUF_INIT; enum object_type type; unsigned long size = 0; + char *buf; name = xstrdup(pathname); strbuf_addf(&fullpath, "%s%s%s", ctx.qry.path ? ctx.qry.path : "", @@ -218,8 +220,7 @@ static int ls_item(const struct object_id *oid, struct strbuf *base, htmlf("Bad object: %s %s", name, oid_to_hex(oid)); - free(name); - return 0; + goto cleanup; } } @@ -239,6 +240,21 @@ static int ls_item(const struct object_id *oid, struct strbuf *base, cgit_tree_link(name, NULL, class.buf, ctx.qry.head, walk_tree_ctx->curr_rev, fullpath.buf); } + if (S_ISLNK(mode)) { + html(" -> "); + buf = read_object_file(oid, &type, &size); + if (!buf) { + htmlf("Error reading object: %s", oid_to_hex(oid)); + goto cleanup; + } + strbuf_addbuf(&linkpath, &fullpath); + strbuf_addf(&linkpath, "/../%s", buf); + strbuf_normalize_path(&linkpath); + cgit_tree_link(buf, NULL, class.buf, ctx.qry.head, + walk_tree_ctx->curr_rev, linkpath.buf); + free(buf); + strbuf_release(&linkpath); + } htmlf("%li", size); html(""); @@ -255,6 +271,8 @@ static int ls_item(const struct object_id *oid, struct strbuf *base, cgit_blame_link("blame", NULL, "button", ctx.qry.head, walk_tree_ctx->curr_rev, fullpath.buf); html("\n"); + +cleanup: free(name); strbuf_release(&fullpath); strbuf_release(&class); -- 2.50.1 From fd20a5475e33d5b7198cc22b6a5a6940c4a1ac90 Mon Sep 17 00:00:00 2001 From: June McEnroe Date: Fri, 21 Feb 2020 08:07:50 +0000 Subject: [PATCH 13/16] ui-commit: show subject in commit page title Signed-off-by: Jason A. Donenfeld --- ui-commit.c | 1 + 1 file changed, 1 insertion(+) diff --git a/ui-commit.c b/ui-commit.c index 948118c..5e88544 100644 --- a/ui-commit.c +++ b/ui-commit.c @@ -43,6 +43,7 @@ void cgit_print_commit(char *hex, const char *prefix) load_ref_decorations(NULL, DECORATE_FULL_REFS); + ctx.page.title = fmtalloc("%s - %s", info->subject, ctx.page.title); cgit_print_layout_start(); cgit_print_diff_ctrls(); html("\n"); -- 2.50.1 From afffc3e772a7b0c9d729f330ef2c9900c4343b63 Mon Sep 17 00:00:00 2001 From: Chris Mayo Date: Fri, 15 Mar 2019 20:17:05 +0000 Subject: [PATCH 14/16] ui-repolist,ui-shared: remove redundant title on repo anchors The title attribute was being set to the same value as the anchor element text. Signed-off-by: Chris Mayo Reviewed-by: Eric Wong Reviewed-by: Petr Vorel Signed-off-by: Jason A. Donenfeld --- ui-repolist.c | 2 +- ui-shared.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ui-repolist.c b/ui-repolist.c index 529a203..d12e3dd 100644 --- a/ui-repolist.c +++ b/ui-repolist.c @@ -321,7 +321,7 @@ void cgit_print_repolist(void) } htmlf("
", !sorted && section ? "sublevel-repo" : "toplevel-repo"); - cgit_summary_link(ctx.repo->name, ctx.repo->name, NULL, NULL); + cgit_summary_link(ctx.repo->name, NULL, NULL, NULL); html(""); repourl = cgit_repourl(ctx.repo->url); html_link_open(repourl, NULL, NULL); diff --git a/ui-shared.c b/ui-shared.c index acd8ab5..f880c4e 100644 --- a/ui-shared.c +++ b/ui-shared.c @@ -995,7 +995,7 @@ static void print_header(void) if (ctx.repo) { cgit_index_link("index", NULL, NULL, NULL, NULL, 0, 1); html(" : "); - cgit_summary_link(ctx.repo->name, ctx.repo->name, NULL, NULL); + cgit_summary_link(ctx.repo->name, NULL, NULL, NULL); if (ctx.env.authenticated) { html(""); html("
\n"); -- 2.50.1 From e32f8416e87503aef2cd2698e15f3dc5e8c40d7e Mon Sep 17 00:00:00 2001 From: Chris Mayo Date: Sun, 26 May 2019 17:57:01 +0100 Subject: [PATCH 15/16] ui-commit: use git raw note format Currently a commit note is shown as: Notes Notes: Change to: Notes Signed-off-by: Chris Mayo Reviewed-by: Alyssa Ross Signed-off-by: Jason A. Donenfeld --- ui-commit.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui-commit.c b/ui-commit.c index 5e88544..0787237 100644 --- a/ui-commit.c +++ b/ui-commit.c @@ -39,7 +39,7 @@ void cgit_print_commit(char *hex, const char *prefix) } info = cgit_parse_commit(commit); - format_display_notes(&oid, ¬es, PAGE_ENCODING, 0); + format_display_notes(&oid, ¬es, PAGE_ENCODING, 1); load_ref_decorations(NULL, DECORATE_FULL_REFS); -- 2.50.1 From 3295155a0caf68d33fecb15f499d205c8e87cd41 Mon Sep 17 00:00:00 2001 From: June McEnroe Date: Thu, 4 Feb 2021 17:10:14 -0500 Subject: [PATCH 16/16] ui-shared: use owner-filter for repo page headers Previously it was only used if owners were displayed on the index. Signed-off-by: Jason A. Donenfeld --- ui-shared.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/ui-shared.c b/ui-shared.c index f880c4e..fbf5a2d 100644 --- a/ui-shared.c +++ b/ui-shared.c @@ -1016,7 +1016,13 @@ static void print_header(void) if (ctx.repo) { html_txt(ctx.repo->desc); html("
"); - html_txt(ctx.repo->owner); + if (ctx.repo->owner_filter) { + cgit_open_filter(ctx.repo->owner_filter); + html_txt(ctx.repo->owner); + cgit_close_filter(ctx.repo->owner_filter); + } else { + html_txt(ctx.repo->owner); + } } else { if (ctx.cfg.root_desc) html_txt(ctx.cfg.root_desc); -- 2.50.1