List for cgit developers and users
 help / color / mirror / Atom feed
From: Kian Kasad <kian@kasad.com>
To: cgit@lists.zx2c4.com
Cc: Kian Kasad <kian@kasad.com>
Subject: [PATCH 3/6] Don't display commit age on graph page
Date: Thu,  4 Aug 2022 21:59:36 -0700	[thread overview]
Message-ID: <20220805045939.57987-4-kian@kasad.com> (raw)
In-Reply-To: <20220805045939.57987-1-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("</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


  parent reply	other threads:[~2022-08-05  5:00 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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       ` Kian Kasad [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220805045939.57987-4-kian@kasad.com \
    --to=kian@kasad.com \
    --cc=cgit@lists.zx2c4.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).