From kian at kasad.com Fri Aug 5 04:59:33 2022 From: kian at kasad.com (Kian Kasad) Date: Thu, 4 Aug 2022 21:59:33 -0700 Subject: [PATCH 0/6] Option for separate 'log' and 'graph' pages In-Reply-To: <20211230210820.3ncgngexbbhlpbdq@frisbee.local> References: <20211230210820.3ncgngexbbhlpbdq@frisbee.local> Message-ID: <20220805045939.57987-1-kian@kasad.com> Since I never got a reply regarding whether this feature is wanted, I'm sending the patches anyways and you all can decide whether or not to merge them. The changes are backwards-compatible so all existing configurations will exhibit exactly the same behavior as before this patch series. See the first patch (1/6) for details of exactly what changes, as it's all documented in that commit's message. -- Kian Kasad kian at kasad.com (925) 871-9823 From kian at kasad.com Fri Aug 5 04:59:34 2022 From: kian at kasad.com (Kian Kasad) Date: Thu, 4 Aug 2022 21:59:34 -0700 Subject: [PATCH 1/6] Implement parsing of new enable-commit-graph option In-Reply-To: <20220805045939.57987-1-kian@kasad.com> References: <20211230210820.3ncgngexbbhlpbdq@frisbee.local> <20220805045939.57987-1-kian@kasad.com> Message-ID: <20220805045939.57987-2-kian@kasad.com> The enable-commit-graph option has been changed from a boolean option to a string option. It takes the following values: "none" or "0": Disable the display of commit graphs completely. The graph page will be disabled and the log page will not show commit graphs. "combined" or "1": Disable the graph page and show the commit graph on the log page. The commit age is still displayed in a separate column. This follows the same behavior as before when this option was set to "1". "separate": Enable the graph page and give it its own tab. The graph page is the same as the log page except it displays the commit graph *instead of* the commit age. The log page shows the commit age and not the commit graph. The "0" and "1" option values should be avoided in new configurations and only exist for backwards compatibility. --- cgit.c | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/cgit.c b/cgit.c index 08d81a1..ce7b291 100644 --- a/cgit.c +++ b/cgit.c @@ -62,9 +62,14 @@ static void repo_config(struct cgit_repo *repo, const char *name, const char *va repo->snapshots = ctx.cfg.snapshots & cgit_parse_snapshots_mask(value); else if (!strcmp(name, "enable-blame")) repo->enable_blame = atoi(value); - else if (!strcmp(name, "enable-commit-graph")) - repo->enable_commit_graph = atoi(value); - else if (!strcmp(name, "enable-log-filecount")) + else if (!strcmp(name, "enable-commit-graph")) { + if (!strcmp(value, "none") || !strcmp(value, "0")) + repo->enable_commit_graph = 0; + else if (!strcmp(value, "combined") || !strcmp(value, "1")) + repo->enable_commit_graph = 1; + else if (!strcmp(value, "separate")) + repo->enable_commit_graph = 2; + } else if (!strcmp(name, "enable-log-filecount")) repo->enable_log_filecount = atoi(value); else if (!strcmp(name, "enable-log-linecount")) repo->enable_log_linecount = atoi(value); @@ -179,9 +184,14 @@ static void config_cb(const char *name, const char *value) ctx.cfg.enable_index_owner = atoi(value); else if (!strcmp(name, "enable-blame")) ctx.cfg.enable_blame = atoi(value); - else if (!strcmp(name, "enable-commit-graph")) - ctx.cfg.enable_commit_graph = atoi(value); - else if (!strcmp(name, "enable-log-filecount")) + else if (!strcmp(name, "enable-commit-graph")) { + if (!strcmp(value, "none") || !strcmp(value, "0")) + ctx.cfg.enable_commit_graph = 0; + else if (!strcmp(value, "combined") || !strcmp(value, "1")) + ctx.cfg.enable_commit_graph = 1; + else if (!strcmp(value, "separate")) + ctx.cfg.enable_commit_graph = 2; + } else if (!strcmp(name, "enable-log-filecount")) ctx.cfg.enable_log_filecount = atoi(value); else if (!strcmp(name, "enable-log-linecount")) ctx.cfg.enable_log_linecount = atoi(value); @@ -818,8 +828,12 @@ static void print_repo(FILE *f, struct cgit_repo *repo) fprintf(f, "repo.clone-url=%s\n", repo->clone_url); fprintf(f, "repo.enable-blame=%d\n", repo->enable_blame); - fprintf(f, "repo.enable-commit-graph=%d\n", - repo->enable_commit_graph); + if (repo->enable_commit_graph) { + if (repo->enable_commit_graph == 1) + fprintf(f, "repo.enable-commit-graph=combined\n"); + if (repo->enable_commit_graph == 2) + fprintf(f, "repo.enable-commit-graph=separate\n"); + } fprintf(f, "repo.enable-log-filecount=%d\n", repo->enable_log_filecount); fprintf(f, "repo.enable-log-linecount=%d\n", -- 2.37.1 From kian at kasad.com Fri Aug 5 04:59:35 2022 From: kian at kasad.com (Kian Kasad) Date: Thu, 4 Aug 2022 21:59:35 -0700 Subject: [PATCH 2/6] Add graph page In-Reply-To: <20220805045939.57987-1-kian@kasad.com> References: <20211230210820.3ncgngexbbhlpbdq@frisbee.local> <20220805045939.57987-1-kian@kasad.com> Message-ID: <20220805045939.57987-3-kian@kasad.com> Adds a basic graph page which is the same as the log page except the commit graph is enabled when the 'enable-commit-graph' option is set to "separate". It does not implement the full option behavior yet. --- cmd.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/cmd.c b/cmd.c index 0eb75b1..1f86047 100644 --- a/cmd.c +++ b/cmd.c @@ -101,7 +101,15 @@ static void log_fn(void) { cgit_print_log(ctx.qry.oid, ctx.qry.ofs, ctx.cfg.max_commit_count, ctx.qry.grep, ctx.qry.search, ctx.qry.path, 1, - ctx.repo->enable_commit_graph, + (ctx.repo->enable_commit_graph == 1) ? 1 : 0, + ctx.repo->commit_sort); +} + +static void graph_fn(void) +{ + cgit_print_log(ctx.qry.oid, ctx.qry.ofs, ctx.cfg.max_commit_count, + ctx.qry.grep, ctx.qry.search, ctx.qry.path, 1, + (ctx.repo->enable_commit_graph == 2) ? 1 : 0, ctx.repo->commit_sort); } @@ -179,6 +187,7 @@ struct cgit_cmd *cgit_get_cmd(void) def_cmd(diff, 1, 1, 0), def_cmd(info, 1, 0, 1), def_cmd(log, 1, 1, 0), + def_cmd(graph, 1, 1, 0), def_cmd(ls_cache, 0, 0, 0), def_cmd(objects, 1, 0, 1), def_cmd(patch, 1, 1, 0), -- 2.37.1 From kian at kasad.com Fri Aug 5 04:59:36 2022 From: kian at kasad.com (Kian Kasad) Date: Thu, 4 Aug 2022 21:59:36 -0700 Subject: [PATCH 3/6] Don't display commit age on graph page In-Reply-To: <20220805045939.57987-1-kian@kasad.com> References: <20211230210820.3ncgngexbbhlpbdq@frisbee.local> <20220805045939.57987-1-kian@kasad.com> Message-ID: <20220805045939.57987-4-kian@kasad.com> Hides the commit age column on the graph page. It is still shown on the log page, even when the "enable-commit-graph" option is set to "combined". --- cmd.c | 2 +- ui-log.c | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/cmd.c b/cmd.c index 1f86047..c780895 100644 --- a/cmd.c +++ b/cmd.c @@ -109,7 +109,7 @@ static void graph_fn(void) { cgit_print_log(ctx.qry.oid, ctx.qry.ofs, ctx.cfg.max_commit_count, ctx.qry.grep, ctx.qry.search, ctx.qry.path, 1, - (ctx.repo->enable_commit_graph == 2) ? 1 : 0, + (ctx.repo->enable_commit_graph == 2) ? 2 : 0, ctx.repo->commit_sort); } diff --git a/ui-log.c b/ui-log.c index 20774bf..c795fb2 100644 --- a/ui-log.c +++ b/ui-log.c @@ -175,7 +175,7 @@ static int show_commit(struct commit *commit, struct rev_info *revs) static void print_commit(struct commit *commit, struct rev_info *revs) { struct commitinfo *info; - int columns = revs->graph ? 4 : 3; + int columns = (revs->graph && ctx.repo->enable_commit_graph == 1) ? 4 : 3; struct strbuf graphbuf = STRBUF_INIT; struct strbuf msgbuf = STRBUF_INIT; @@ -246,7 +246,7 @@ static void print_commit(struct commit *commit, struct rev_info *revs) html_txt(info->author); cgit_close_filter(ctx.repo->email_filter); - if (revs->graph) { + if (revs->graph && ctx.repo->enable_commit_graph == 1) { html(""); cgit_print_age(info->committer_date, info->committer_tz, TM_WEEK * 2); } @@ -368,7 +368,7 @@ void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *pattern struct rev_info rev; struct commit *commit; struct strvec rev_argv = STRVEC_INIT; - int i, columns = commit_graph ? 4 : 3; + int i, columns = commit_graph == 1 ? 4 : 3; int must_free_tip = 0; /* rev_argv.argv[0] will be ignored by setup_revisions */ @@ -471,7 +471,7 @@ void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *pattern html(")"); } html("Author"); - if (rev.graph) + if (rev.graph && commit_graph == 1) html("Age"); if (ctx.repo->enable_log_filecount) { html("Files"); -- 2.37.1 From kian at kasad.com Fri Aug 5 04:59:37 2022 From: kian at kasad.com (Kian Kasad) Date: Thu, 4 Aug 2022 21:59:37 -0700 Subject: [PATCH 4/6] Don't display graph page if enable-commit-graph is not set to "separate" In-Reply-To: <20220805045939.57987-1-kian@kasad.com> References: <20211230210820.3ncgngexbbhlpbdq@frisbee.local> <20220805045939.57987-1-kian@kasad.com> Message-ID: <20220805045939.57987-5-kian@kasad.com> If the graph page is not supposed to be enabled, it returns a "404 Not Found" error page. --- cmd.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cmd.c b/cmd.c index c780895..6940b60 100644 --- a/cmd.c +++ b/cmd.c @@ -107,6 +107,8 @@ static void log_fn(void) static void graph_fn(void) { + if (ctx.repo->enable_commit_graph != 2) + return cgit_print_error_page(404, "Not found", "Not found"); cgit_print_log(ctx.qry.oid, ctx.qry.ofs, ctx.cfg.max_commit_count, ctx.qry.grep, ctx.qry.search, ctx.qry.path, 1, (ctx.repo->enable_commit_graph == 2) ? 2 : 0, -- 2.37.1 From kian at kasad.com Fri Aug 5 04:59:38 2022 From: kian at kasad.com (Kian Kasad) Date: Thu, 4 Aug 2022 21:59:38 -0700 Subject: [PATCH 5/6] Add graph page tab if enable-commit-graph is set to "separate" In-Reply-To: <20220805045939.57987-1-kian@kasad.com> References: <20211230210820.3ncgngexbbhlpbdq@frisbee.local> <20220805045939.57987-1-kian@kasad.com> Message-ID: <20220805045939.57987-6-kian@kasad.com> If "enable-commit-graph" is set to "separate", a tab is added in the navigation bar for the graph page. It sits next to the "log" link. --- ui-shared.c | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/ui-shared.c b/ui-shared.c index acd8ab5..a0c326e 100644 --- a/ui-shared.c +++ b/ui-shared.c @@ -401,6 +401,49 @@ void cgit_log_link(const char *name, const char *title, const char *class, html(""); } +void cgit_graph_link(const char *name, const char *title, const char *class, + const char *head, const char *rev, const char *path, + int ofs, const char *grep, const char *pattern, int showmsg, + int follow) +{ + char *delim; + + delim = repolink(title, class, "graph", head, path); + if (rev && ctx.qry.head && strcmp(rev, ctx.qry.head)) { + html(delim); + html("id="); + html_url_arg(rev); + delim = "&"; + } + if (grep && pattern) { + html(delim); + html("qt="); + html_url_arg(grep); + delim = "&"; + html(delim); + html("q="); + html_url_arg(pattern); + } + if (ofs > 0) { + html(delim); + html("ofs="); + htmlf("%d", ofs); + delim = "&"; + } + if (showmsg) { + html(delim); + html("showmsg=1"); + delim = "&"; + } + if (follow) { + html(delim); + html("follow=1"); + } + html("'>"); + html_txt(name); + html(""); +} + void cgit_commit_link(const char *name, const char *title, const char *class, const char *head, const char *rev, const char *path) { @@ -1043,6 +1086,10 @@ void cgit_print_pageheader(void) cgit_log_link("log", NULL, hc("log"), ctx.qry.head, NULL, ctx.qry.vpath, 0, NULL, NULL, ctx.qry.showmsg, ctx.qry.follow); + if (ctx.repo->enable_commit_graph == 2) + cgit_graph_link("graph", NULL, hc("graph"), ctx.qry.head, + NULL, ctx.qry.vpath, 0, NULL, NULL, + ctx.qry.showmsg, ctx.qry.follow); if (ctx.qry.page && !strcmp(ctx.qry.page, "blame")) cgit_blame_link("blame", NULL, hc("blame"), ctx.qry.head, ctx.qry.oid, ctx.qry.vpath); -- 2.37.1 From kian at kasad.com Fri Aug 5 04:59:39 2022 From: kian at kasad.com (Kian Kasad) Date: Thu, 4 Aug 2022 21:59:39 -0700 Subject: [PATCH 6/6] Document new enable-commit-graph option In-Reply-To: <20220805045939.57987-1-kian@kasad.com> References: <20211230210820.3ncgngexbbhlpbdq@frisbee.local> <20220805045939.57987-1-kian@kasad.com> Message-ID: <20220805045939.57987-7-kian@kasad.com> --- cgitrc.5.txt | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/cgitrc.5.txt b/cgitrc.5.txt index 33a6a8c..59b097a 100644 --- a/cgitrc.5.txt +++ b/cgitrc.5.txt @@ -147,9 +147,12 @@ enable-blame:: places. Default value: "0". enable-commit-graph:: - Flag which, when set to "1", will make cgit print an ASCII-art commit + Flag which, when set to "combined", will make cgit print an ASCII-art commit history graph to the left of the commit messages in the repository - log page. Default value: "0". + log page. When set to "separate", cgit will create a separate graph page + which displays an ASCII-art commit graph, and it will not display the + graph on the log page. Set to "none" to disable all graphs. + Default value: "none". enable-filter-overrides:: Flag which, when set to "1", allows all filter settings to be -- 2.37.1 From list at eworm.de Thu Aug 11 20:09:37 2022 From: list at eworm.de (Christian Hesse) Date: Thu, 11 Aug 2022 22:09:37 +0200 Subject: [PATCH 1/1] git: update to v2.37.2 Message-ID: <20220811200937.13063-1-list@eworm.de> From: Christian Hesse 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.37.2 From list at eworm.de Tue Aug 30 20:44:36 2022 From: list at eworm.de (Christian Hesse) Date: Tue, 30 Aug 2022 22:44:36 +0200 Subject: [PATCH 1/1] git: update to v2.37.3 Message-ID: <20220830204436.37191-1-list@eworm.de> From: Christian Hesse 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.37.3