aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2026-02-24 11:48:54 +0100
committerJason A. Donenfeld <Jason@zx2c4.com>2026-02-24 11:49:35 +0100
commit0d28d54f0a287ee3e5a12d14ffd2ee23b5e22d76 (patch)
treeec8517157a5f04a1c2cd5a49d9eeb4c3af90f63b
parentBump version (diff)
downloadcgit-master.tar.xz
cgit-master.zip
ui-log: allow link following to be disabled per-repoHEADmaster
This exists for other CPU heavy operations like blame, but doesn't for the follow functionality. Add it for that. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
-rw-r--r--cgit.c4
-rw-r--r--cgit.h1
-rw-r--r--cgitrc.5.txt4
-rw-r--r--shared.c1
-rw-r--r--ui-diff.c2
-rw-r--r--ui-log.c2
-rw-r--r--ui-shared.c2
7 files changed, 13 insertions, 3 deletions
diff --git a/cgit.c b/cgit.c
index 579db64..c91897a 100644
--- a/cgit.c
+++ b/cgit.c
@@ -66,6 +66,8 @@ static void repo_config(struct cgit_repo *repo, const char *name, const char *va
repo->enable_blame = atoi(value);
else if (!strcmp(name, "enable-commit-graph"))
repo->enable_commit_graph = atoi(value);
+ else if (!strcmp(name, "enable-follow-links"))
+ repo->enable_follow_links = atoi(value);
else if (!strcmp(name, "enable-log-filecount"))
repo->enable_log_filecount = atoi(value);
else if (!strcmp(name, "enable-log-linecount"))
@@ -828,6 +830,8 @@ static void print_repo(FILE *f, struct cgit_repo *repo)
repo->enable_blame);
fprintf(f, "repo.enable-commit-graph=%d\n",
repo->enable_commit_graph);
+ fprintf(f, "repo.enable-follow-links=%d\n",
+ repo->enable_follow_links);
fprintf(f, "repo.enable-log-filecount=%d\n",
repo->enable_log_filecount);
fprintf(f, "repo.enable-log-linecount=%d\n",
diff --git a/cgit.h b/cgit.h
index 28d2772..6945eb9 100644
--- a/cgit.h
+++ b/cgit.h
@@ -101,6 +101,7 @@ struct cgit_repo {
int snapshots;
int enable_blame;
int enable_commit_graph;
+ int enable_follow_links;
int enable_log_filecount;
int enable_log_linecount;
int enable_remote_branches;
diff --git a/cgitrc.5.txt b/cgitrc.5.txt
index 6f3e952..7c39bf9 100644
--- a/cgitrc.5.txt
+++ b/cgitrc.5.txt
@@ -503,6 +503,10 @@ repo.enable-commit-graph::
A flag which can be used to disable the global setting
`enable-commit-graph'. Default value: none.
+repo.enable-follow-links::
+ A flag which can be used to disable the global setting
+ `enable-follow-links'. Default value: none.
+
repo.enable-html-serving::
A flag which can be used to override the global setting
`enable-html-serving`. Default value: none.
diff --git a/shared.c b/shared.c
index 07b38ba..cec2c81 100644
--- a/shared.c
+++ b/shared.c
@@ -62,6 +62,7 @@ struct cgit_repo *cgit_add_repo(const char *url)
ret->snapshots = ctx.cfg.snapshots;
ret->enable_blame = ctx.cfg.enable_blame;
ret->enable_commit_graph = ctx.cfg.enable_commit_graph;
+ ret->enable_follow_links = ctx.cfg.enable_follow_links;
ret->enable_log_filecount = ctx.cfg.enable_log_filecount;
ret->enable_log_linecount = ctx.cfg.enable_log_linecount;
ret->enable_remote_branches = ctx.cfg.enable_remote_branches;
diff --git a/ui-diff.c b/ui-diff.c
index a824546..6cfa697 100644
--- a/ui-diff.c
+++ b/ui-diff.c
@@ -395,7 +395,7 @@ void cgit_print_diff(const char *new_rev, const char *old_rev,
* entire commit to detect renames so we must limit the paths in our
* own callbacks and not pass the prefix to the diff machinery.
*/
- if (ctx.qry.follow && ctx.cfg.enable_follow_links) {
+ if (ctx.qry.follow && ctx.repo->enable_follow_links) {
current_prefix = prefix;
prefix = "";
} else {
diff --git a/ui-log.c b/ui-log.c
index c7b3b3f..9906bbc 100644
--- a/ui-log.c
+++ b/ui-log.c
@@ -407,7 +407,7 @@ void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *pattern
}
}
- if (!path || !ctx.cfg.enable_follow_links) {
+ if (!path || !ctx.repo->enable_follow_links) {
/*
* If we don't have a path, "follow" is a no-op so make sure
* the variable is set to false to avoid needing to check
diff --git a/ui-shared.c b/ui-shared.c
index 7f2d566..219b830 100644
--- a/ui-shared.c
+++ b/ui-shared.c
@@ -1153,7 +1153,7 @@ void cgit_print_pageheader(void)
html("<div class='path'>");
html("path: ");
cgit_print_path_crumbs(ctx.qry.vpath);
- if (ctx.cfg.enable_follow_links && !strcmp(ctx.qry.page, "log")) {
+ if (ctx.repo->enable_follow_links && !strcmp(ctx.qry.page, "log")) {
html(" (");
ctx.qry.follow = !ctx.qry.follow;
cgit_self_link(ctx.qry.follow ? "follow" : "unfollow",