From: Kian Kasad <kian@kasad.com>
To: cgit@lists.zx2c4.com
Cc: Kian Kasad <kian@kasad.com>
Subject: [PATCH 1/6] Implement parsing of new enable-commit-graph option
Date: Thu, 4 Aug 2022 21:59:34 -0700 [thread overview]
Message-ID: <20220805045939.57987-2-kian@kasad.com> (raw)
In-Reply-To: <20220805045939.57987-1-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
next prev parent reply other threads:[~2022-08-05 5:00 UTC|newest]
Thread overview: 12+ 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 ` Kian Kasad [this message]
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
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-2-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).