[PATCH 2/6] Add graph page

Kian Kasad kian at kasad.com
Fri Aug 5 04:59:35 UTC 2022


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



More information about the CGit mailing list