List for cgit developers and users
 help / color / mirror / Atom feed
* User-configurable log graph option
@ 2021-02-18 22:31 Kian Kasad
  2021-02-19 12:22 ` John Keeping
  0 siblings, 1 reply; 12+ messages in thread
From: Kian Kasad @ 2021-02-18 22:31 UTC (permalink / raw)
  To: cgit

[-- Attachment #1: Type: text/plain, Size: 420 bytes --]

Hello,

I'm using cgit on my website and I'm wondering if it's possible to allow
the user (i.e. the person visiting the site) to choose whether or not
the commit graph is displayed on the log page.

If this isn't currently possible, what do you think about adding such
functionality? Maybe something like how the diff page lets the user
choose between a "unified diff" and "ssdiff".

--
Kian Kasad
PGP 0x1715EEAA14DAEC1

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: User-configurable log graph option
  2021-02-18 22:31 User-configurable log graph option Kian Kasad
@ 2021-02-19 12:22 ` John Keeping
  2021-12-30 21:08   ` Kian Kasad
  0 siblings, 1 reply; 12+ messages in thread
From: John Keeping @ 2021-02-19 12:22 UTC (permalink / raw)
  To: Kian Kasad; +Cc: cgit

On Thu, Feb 18, 2021 at 02:31:26PM -0800, Kian Kasad wrote:
> I'm using cgit on my website and I'm wondering if it's possible to allow
> the user (i.e. the person visiting the site) to choose whether or not
> the commit graph is displayed on the log page.
> 
> If this isn't currently possible, what do you think about adding such
> functionality? Maybe something like how the diff page lets the user
> choose between a "unified diff" and "ssdiff".

This sounds like a great new feature!

I think we still want to allow the administrator to turn the feature
on/off but if it is permitted, then it makes sense to allow the end user
to choose whether or not they want it enabled.

Patches welcome :-)

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: User-configurable log graph option
  2021-02-19 12:22 ` John Keeping
@ 2021-12-30 21:08   ` Kian Kasad
  2022-08-05  4:59     ` [PATCH 0/6] Option for separate 'log' and 'graph' pages Kian Kasad
  2023-01-05 23:14     ` Follow-up: User-configurable log graph option Kian Kasad
  0 siblings, 2 replies; 12+ messages in thread
From: Kian Kasad @ 2021-12-30 21:08 UTC (permalink / raw)
  To: John Keeping; +Cc: cgit

[-- Attachment #1: Type: text/plain, Size: 1898 bytes --]

On 21/02/19 12:22PM, John Keeping wrote:
> On Thu, Feb 18, 2021 at 02:31:26PM -0800, Kian Kasad wrote:
> > I'm using cgit on my website and I'm wondering if it's possible to allow
> > the user (i.e. the person visiting the site) to choose whether or not
> > the commit graph is displayed on the log page.
> > 
> > If this isn't currently possible, what do you think about adding such
> > functionality? Maybe something like how the diff page lets the user
> > choose between a "unified diff" and "ssdiff".
> 
> This sounds like a great new feature!
> 
> I think we still want to allow the administrator to turn the feature
> on/off but if it is permitted, then it makes sense to allow the end user
> to choose whether or not they want it enabled.

Following up on this as I'm finally getting around to implementing this
feature. I'm not too familiar with CGit's codebase, so I think it would
be easier to implement this as a separate "graph" page which is
identical to the log page except that it always displays a graph.

This graph page would only be shown in the navbar's tab list if the
"enable-commit-graph" option is set to "separate" in the configuration.
If it is set to "combined" then the graph page will be disabled and the
commit graph will be displayed on the log page as it currently is when
the "enable-commit-graph" option is set to "1".

In order to maintain backwards compatibility, the value "1" could also
be interpreted as the value "combined" since it has the same
functionality currently.

The value "none" (or "0" for backwards compatibility) would disable the
graph page as well as disabling the commit graph on the log page.

I've already started working on this as I want it for my own CGit site.
If this is something that the maintainer(s) want to integrate, I'll send
patches when I'm done.

--
Kian Kasad
PGP 0x1715EEAA14DAEC1

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH 0/6] Option for separate 'log' and 'graph' pages
  2021-12-30 21:08   ` Kian Kasad
@ 2022-08-05  4:59     ` Kian Kasad
  2022-08-05  4:59       ` [PATCH 1/6] Implement parsing of new enable-commit-graph option Kian Kasad
                         ` (5 more replies)
  2023-01-05 23:14     ` Follow-up: User-configurable log graph option Kian Kasad
  1 sibling, 6 replies; 12+ messages in thread
From: Kian Kasad @ 2022-08-05  4:59 UTC (permalink / raw)
  To: cgit

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@kasad.com
(925) 871-9823



^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH 1/6] Implement parsing of new enable-commit-graph option
  2022-08-05  4:59     ` [PATCH 0/6] Option for separate 'log' and 'graph' pages Kian Kasad
@ 2022-08-05  4:59       ` Kian Kasad
  2022-08-05  4:59       ` [PATCH 2/6] Add graph page Kian Kasad
                         ` (4 subsequent siblings)
  5 siblings, 0 replies; 12+ messages in thread
From: Kian Kasad @ 2022-08-05  4:59 UTC (permalink / raw)
  To: cgit; +Cc: Kian Kasad

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


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH 2/6] Add graph page
  2022-08-05  4:59     ` [PATCH 0/6] Option for separate 'log' and 'graph' pages Kian Kasad
  2022-08-05  4:59       ` [PATCH 1/6] Implement parsing of new enable-commit-graph option Kian Kasad
@ 2022-08-05  4:59       ` Kian Kasad
  2022-08-05  4:59       ` [PATCH 3/6] Don't display commit age on " Kian Kasad
                         ` (3 subsequent siblings)
  5 siblings, 0 replies; 12+ messages in thread
From: Kian Kasad @ 2022-08-05  4:59 UTC (permalink / raw)
  To: cgit; +Cc: Kian Kasad

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


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH 3/6] Don't display commit age on graph page
  2022-08-05  4:59     ` [PATCH 0/6] Option for separate 'log' and 'graph' pages Kian Kasad
  2022-08-05  4:59       ` [PATCH 1/6] Implement parsing of new enable-commit-graph option Kian Kasad
  2022-08-05  4:59       ` [PATCH 2/6] Add graph page Kian Kasad
@ 2022-08-05  4:59       ` Kian Kasad
  2022-08-05  4:59       ` [PATCH 4/6] Don't display graph page if enable-commit-graph is not set to "separate" Kian Kasad
                         ` (2 subsequent siblings)
  5 siblings, 0 replies; 12+ messages in thread
From: Kian Kasad @ 2022-08-05  4:59 UTC (permalink / raw)
  To: cgit; +Cc: Kian Kasad

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("</td><td>");
 		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("</th><th class='left'>Author</th>");
-	if (rev.graph)
+	if (rev.graph && commit_graph == 1)
 		html("<th class='left'>Age</th>");
 	if (ctx.repo->enable_log_filecount) {
 		html("<th class='left'>Files</th>");
-- 
2.37.1


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH 4/6] Don't display graph page if enable-commit-graph is not set to "separate"
  2022-08-05  4:59     ` [PATCH 0/6] Option for separate 'log' and 'graph' pages Kian Kasad
                         ` (2 preceding siblings ...)
  2022-08-05  4:59       ` [PATCH 3/6] Don't display commit age on " Kian Kasad
@ 2022-08-05  4:59       ` Kian Kasad
  2022-08-05  4:59       ` [PATCH 5/6] Add graph page tab if enable-commit-graph is " Kian Kasad
  2022-08-05  4:59       ` [PATCH 6/6] Document new enable-commit-graph option Kian Kasad
  5 siblings, 0 replies; 12+ messages in thread
From: Kian Kasad @ 2022-08-05  4:59 UTC (permalink / raw)
  To: cgit; +Cc: Kian Kasad

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


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH 5/6] Add graph page tab if enable-commit-graph is set to "separate"
  2022-08-05  4:59     ` [PATCH 0/6] Option for separate 'log' and 'graph' pages Kian Kasad
                         ` (3 preceding siblings ...)
  2022-08-05  4:59       ` [PATCH 4/6] Don't display graph page if enable-commit-graph is not set to "separate" Kian Kasad
@ 2022-08-05  4:59       ` Kian Kasad
  2022-08-05  4:59       ` [PATCH 6/6] Document new enable-commit-graph option Kian Kasad
  5 siblings, 0 replies; 12+ messages in thread
From: Kian Kasad @ 2022-08-05  4:59 UTC (permalink / raw)
  To: cgit; +Cc: Kian Kasad

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("</a>");
 }
 
+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 = "&amp;";
+	}
+	if (grep && pattern) {
+		html(delim);
+		html("qt=");
+		html_url_arg(grep);
+		delim = "&amp;";
+		html(delim);
+		html("q=");
+		html_url_arg(pattern);
+	}
+	if (ofs > 0) {
+		html(delim);
+		html("ofs=");
+		htmlf("%d", ofs);
+		delim = "&amp;";
+	}
+	if (showmsg) {
+		html(delim);
+		html("showmsg=1");
+		delim = "&amp;";
+	}
+	if (follow) {
+		html(delim);
+		html("follow=1");
+	}
+	html("'>");
+	html_txt(name);
+	html("</a>");
+}
+
 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


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH 6/6] Document new enable-commit-graph option
  2022-08-05  4:59     ` [PATCH 0/6] Option for separate 'log' and 'graph' pages Kian Kasad
                         ` (4 preceding siblings ...)
  2022-08-05  4:59       ` [PATCH 5/6] Add graph page tab if enable-commit-graph is " Kian Kasad
@ 2022-08-05  4:59       ` Kian Kasad
  5 siblings, 0 replies; 12+ messages in thread
From: Kian Kasad @ 2022-08-05  4:59 UTC (permalink / raw)
  To: cgit; +Cc: Kian Kasad

---
 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


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Follow-up: User-configurable log graph option
  2021-12-30 21:08   ` Kian Kasad
  2022-08-05  4:59     ` [PATCH 0/6] Option for separate 'log' and 'graph' pages Kian Kasad
@ 2023-01-05 23:14     ` Kian Kasad
  2023-07-01  6:28       ` Daniel Campbell
  1 sibling, 1 reply; 12+ messages in thread
From: Kian Kasad @ 2023-01-05 23:14 UTC (permalink / raw)
  To: cgit

Hello cgit developers,

Just over a year ago, I proposed a configurable "graph" option for the
log page. The idea was met with positive feedback, but when I proposed
my implementation I never heard back. So I'm trying again in hopes that
I can get a response. It would be nice if this was merged into the
upstream so I don't have to maintain my fork, but if the way I've
chosen to go about it isn't desirable, then I understand. But even in
the latter case, I need a "no" so I know to stop trying to push this.

The original conversation is below. I've also finished the
implementation and am using it at https://git.kasad.com if you'd like
to test it out.

See here for my fork of cgit implementing this change:
https://git.kasad.com/cgit/log/?h=feat%2Fgraph-page

On Thu, 2021-12-30 at 13:08 -0800, Kian Kasad wrote:
> On 21/02/19 12:22PM, John Keeping wrote:
> > On Thu, Feb 18, 2021 at 02:31:26PM -0800, Kian Kasad wrote:
> > > I'm using cgit on my website and I'm wondering if it's possible
> > > to allow
> > > the user (i.e. the person visiting the site) to choose whether or
> > > not
> > > the commit graph is displayed on the log page.
> > > 
> > > If this isn't currently possible, what do you think about adding
> > > such
> > > functionality? Maybe something like how the diff page lets the
> > > user
> > > choose between a "unified diff" and "ssdiff".
> > 
> > This sounds like a great new feature!
> > 
> > I think we still want to allow the administrator to turn the
> > feature
> > on/off but if it is permitted, then it makes sense to allow the end
> > user
> > to choose whether or not they want it enabled.
> 
> Following up on this as I'm finally getting around to implementing
> this
> feature. I'm not too familiar with CGit's codebase, so I think it
> would
> be easier to implement this as a separate "graph" page which is
> identical to the log page except that it always displays a graph.
> 
> This graph page would only be shown in the navbar's tab list if the
> "enable-commit-graph" option is set to "separate" in the
> configuration.
> If it is set to "combined" then the graph page will be disabled and
> the
> commit graph will be displayed on the log page as it currently is
> when
> the "enable-commit-graph" option is set to "1".
> 
> In order to maintain backwards compatibility, the value "1" could
> also
> be interpreted as the value "combined" since it has the same
> functionality currently.
> 
> The value "none" (or "0" for backwards compatibility) would disable
> the
> graph page as well as disabling the commit graph on the log page.
> 
> I've already started working on this as I want it for my own CGit
> site.
> If this is something that the maintainer(s) want to integrate, I'll
> send
> patches when I'm done.

-- 
Kian Kasad
PGP 0x1715EEAA14DAEC1
kian@kasad.com
(925) 871-9823

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Follow-up: User-configurable log graph option
  2023-01-05 23:14     ` Follow-up: User-configurable log graph option Kian Kasad
@ 2023-07-01  6:28       ` Daniel Campbell
  0 siblings, 0 replies; 12+ messages in thread
From: Daniel Campbell @ 2023-07-01  6:28 UTC (permalink / raw)
  To: cgit

On Thu, Jan 05, 2023 at 03:14:42PM -0800, Kian Kasad wrote:
> Hello cgit developers,
>
> Just over a year ago, I proposed a configurable "graph" option for the
> log page. The idea was met with positive feedback, but when I proposed
> my implementation I never heard back. So I'm trying again in hopes that
> I can get a response. It would be nice if this was merged into the
> upstream so I don't have to maintain my fork, but if the way I've
> chosen to go about it isn't desirable, then I understand. But even in
> the latter case, I need a "no" so I know to stop trying to push this.
>
> The original conversation is below. I've also finished the
> implementation and am using it at https://git.kasad.com if you'd like
> to test it out.
>
> See here for my fork of cgit implementing this change:
> https://git.kasad.com/cgit/log/?h=feat%2Fgraph-page
>
> On Thu, 2021-12-30 at 13:08 -0800, Kian Kasad wrote:
> > On 21/02/19 12:22PM, John Keeping wrote:
> > > On Thu, Feb 18, 2021 at 02:31:26PM -0800, Kian Kasad wrote:
> > > > I'm using cgit on my website and I'm wondering if it's possible
> > > > to allow
> > > > the user (i.e. the person visiting the site) to choose whether or
> > > > not
> > > > the commit graph is displayed on the log page.
> > > >
> > > > If this isn't currently possible, what do you think about adding
> > > > such
> > > > functionality? Maybe something like how the diff page lets the
> > > > user
> > > > choose between a "unified diff" and "ssdiff".
> > >
> > > This sounds like a great new feature!
> > >
> > > I think we still want to allow the administrator to turn the
> > > feature
> > > on/off but if it is permitted, then it makes sense to allow the end
> > > user
> > > to choose whether or not they want it enabled.
> >
> > Following up on this as I'm finally getting around to implementing
> > this
> > feature. I'm not too familiar with CGit's codebase, so I think it
> > would
> > be easier to implement this as a separate "graph" page which is
> > identical to the log page except that it always displays a graph.
> >
> > This graph page would only be shown in the navbar's tab list if the
> > "enable-commit-graph" option is set to "separate" in the
> > configuration.
> > If it is set to "combined" then the graph page will be disabled and
> > the
> > commit graph will be displayed on the log page as it currently is
> > when
> > the "enable-commit-graph" option is set to "1".
> >
> > In order to maintain backwards compatibility, the value "1" could
> > also
> > be interpreted as the value "combined" since it has the same
> > functionality currently.
> >
> > The value "none" (or "0" for backwards compatibility) would disable
> > the
> > graph page as well as disabling the commit graph on the log page.
> >
> > I've already started working on this as I want it for my own CGit
> > site.
> > If this is something that the maintainer(s) want to integrate, I'll
> > send
> > patches when I'm done.
>
> --
> Kian Kasad
> PGP 0x1715EEAA14DAEC1
> kian@kasad.com
> (925) 871-9823

Hi!

I'm not a regular developer of cgit, so I can't make any claims
regarding whether it's suitable for merge, but I took some time to
check out your cgit instance. I encountered some difficulty fully
understanding what your patchset did, until I looked at the links and
played around a little.

Your graph page's "Expand" and "Collapse" links are pointing to the log
page.  I have to navigate *back* to /graph/ with the ?showmsg=1 GET data
to see the commit-graph's pipes (indicating linear history in most
repositories, as expected), and Collapse will remove the GET data,
but bump me back over to the log page. I also looked around your instance
trying to find a repository with a complex commit graph so I could
better visualize your work. Can you recommend one to look at? The
feature sounds interesting but there is trouble getting to it for now.

The graph page still shows the Age column, but the column data is the
commit date. Is it possible to modify column headers without having to
duplicate the log page's code? Less a direct question, just something to
ponder. It may be necessary, if the graph page's features diverge too
far from what the log page currently offers.

I think this feature could be handy, especially for projects with
complex commit graphs.

To be more explicit, I would:

* find a way to get the expand and collapse links to stay on the graph
  page, so the new code is triggered.
* change "Age" to "Date" in the first column header of the graph page

If I understand correctly, the graph page is only accessible when the
option is set to 'separate'. Assuming your instance is using this
setting, is there any major difference between what we see on your
instance, and the 'combined' setting? I am imagining that the log page
just takes on the commit graph settings and the graph tab disappears.
Is the column that holds dates still labeled 'Age' in that mode?

Maybe it's not considered major enough to worry about -- age and date
both having to do with time -- but it may also point to a need for a
graph page to be distinct flavor of the log page's code. It'd be best to
defer to cgit devs on this particular decision. Being its own page seems
better imo.

Please let me know if I've misunderstood something or am unclear. It's
been a while since I've reviewed code and I mean no offense or insult.

~Daniel

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2023-07-01  6:29 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-18 22:31 User-configurable log graph option Kian Kasad
2021-02-19 12:22 ` John Keeping
2021-12-30 21:08   ` Kian Kasad
2022-08-05  4:59     ` [PATCH 0/6] Option for separate 'log' and 'graph' pages Kian Kasad
2022-08-05  4:59       ` [PATCH 1/6] Implement parsing of new enable-commit-graph option Kian Kasad
2022-08-05  4:59       ` [PATCH 2/6] Add graph page Kian Kasad
2022-08-05  4:59       ` [PATCH 3/6] Don't display commit age on " Kian Kasad
2022-08-05  4:59       ` [PATCH 4/6] Don't display graph page if enable-commit-graph is not set to "separate" Kian Kasad
2022-08-05  4:59       ` [PATCH 5/6] Add graph page tab if enable-commit-graph is " Kian Kasad
2022-08-05  4:59       ` [PATCH 6/6] Document new enable-commit-graph option Kian Kasad
2023-01-05 23:14     ` Follow-up: User-configurable log graph option Kian Kasad
2023-07-01  6:28       ` Daniel Campbell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).