diff options
| author | 2026-02-24 11:48:54 +0100 | |
|---|---|---|
| committer | 2026-02-24 11:49:35 +0100 | |
| commit | 0d28d54f0a287ee3e5a12d14ffd2ee23b5e22d76 (patch) | |
| tree | ec8517157a5f04a1c2cd5a49d9eeb4c3af90f63b | |
| parent | Bump version (diff) | |
| download | cgit-master.tar.xz cgit-master.zip | |
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.c | 4 | ||||
| -rw-r--r-- | cgit.h | 1 | ||||
| -rw-r--r-- | cgitrc.5.txt | 4 | ||||
| -rw-r--r-- | shared.c | 1 | ||||
| -rw-r--r-- | ui-diff.c | 2 | ||||
| -rw-r--r-- | ui-log.c | 2 | ||||
| -rw-r--r-- | ui-shared.c | 2 |
7 files changed, 13 insertions, 3 deletions
@@ -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", @@ -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. @@ -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; @@ -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 { @@ -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", |
