[PATCH 3/6] Don't display commit age on graph page

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


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



More information about the CGit mailing list