diff options
-rw-r--r-- | cgit.c | 4 | ||||
-rw-r--r-- | cgit.h | 1 | ||||
-rw-r--r-- | cgitrc.5.txt | 4 | ||||
-rw-r--r-- | cmd.c | 2 | ||||
-rw-r--r-- | shared.c | 1 | ||||
-rw-r--r-- | ui-tree.c | 4 |
6 files changed, 13 insertions, 3 deletions
diff --git a/cgit.c b/cgit.c index 2f07e6d..2910d4b 100644 --- a/cgit.c +++ b/cgit.c | |||
@@ -50,6 +50,8 @@ static void repo_config(struct cgit_repo *repo, const char *name, const char *va | |||
50 | repo->extra_head_content = xstrdup(value); | 50 | repo->extra_head_content = xstrdup(value); |
51 | else if (!strcmp(name, "snapshots")) | 51 | else if (!strcmp(name, "snapshots")) |
52 | repo->snapshots = ctx.cfg.snapshots & cgit_parse_snapshots_mask(value); | 52 | repo->snapshots = ctx.cfg.snapshots & cgit_parse_snapshots_mask(value); |
53 | else if (!strcmp(name, "enable-blame")) | ||
54 | repo->enable_blame = atoi(value); | ||
53 | else if (!strcmp(name, "enable-commit-graph")) | 55 | else if (!strcmp(name, "enable-commit-graph")) |
54 | repo->enable_commit_graph = atoi(value); | 56 | repo->enable_commit_graph = atoi(value); |
55 | else if (!strcmp(name, "enable-log-filecount")) | 57 | else if (!strcmp(name, "enable-log-filecount")) |
@@ -809,6 +811,8 @@ static void print_repo(FILE *f, struct cgit_repo *repo) | |||
809 | fprintf(f, "repo.homepage=%s\n", repo->homepage); | 811 | fprintf(f, "repo.homepage=%s\n", repo->homepage); |
810 | if (repo->clone_url) | 812 | if (repo->clone_url) |
811 | fprintf(f, "repo.clone-url=%s\n", repo->clone_url); | 813 | fprintf(f, "repo.clone-url=%s\n", repo->clone_url); |
814 | fprintf(f, "repo.enable-blame=%d\n", | ||
815 | repo->enable_blame); | ||
812 | fprintf(f, "repo.enable-commit-graph=%d\n", | 816 | fprintf(f, "repo.enable-commit-graph=%d\n", |
813 | repo->enable_commit_graph); | 817 | repo->enable_commit_graph); |
814 | fprintf(f, "repo.enable-log-filecount=%d\n", | 818 | fprintf(f, "repo.enable-log-filecount=%d\n", |
diff --git a/cgit.h b/cgit.h index bcc4fce..7ec46b4 100644 --- a/cgit.h +++ b/cgit.h | |||
@@ -94,6 +94,7 @@ struct cgit_repo { | |||
94 | char *logo_link; | 94 | char *logo_link; |
95 | char *snapshot_prefix; | 95 | char *snapshot_prefix; |
96 | int snapshots; | 96 | int snapshots; |
97 | int enable_blame; | ||
97 | int enable_commit_graph; | 98 | int enable_commit_graph; |
98 | int enable_log_filecount; | 99 | int enable_log_filecount; |
99 | int enable_log_linecount; | 100 | int enable_log_linecount; |
diff --git a/cgitrc.5.txt b/cgitrc.5.txt index 34b351b..ba77826 100644 --- a/cgitrc.5.txt +++ b/cgitrc.5.txt | |||
@@ -485,6 +485,10 @@ repo.email-filter:: | |||
485 | Override the default email-filter. Default value: none. See also: | 485 | Override the default email-filter. Default value: none. See also: |
486 | "enable-filter-overrides". See also: "FILTER API". | 486 | "enable-filter-overrides". See also: "FILTER API". |
487 | 487 | ||
488 | repo.enable-blame:: | ||
489 | A flag which can be used to disable the global setting | ||
490 | `enable-blame'. Default value: none. | ||
491 | |||
488 | repo.enable-commit-graph:: | 492 | repo.enable-commit-graph:: |
489 | A flag which can be used to disable the global setting | 493 | A flag which can be used to disable the global setting |
490 | `enable-commit-graph'. Default value: none. | 494 | `enable-commit-graph'. Default value: none. |
diff --git a/cmd.c b/cmd.c index 63f0ae5..bf6d8f5 100644 --- a/cmd.c +++ b/cmd.c | |||
@@ -66,7 +66,7 @@ static void about_fn(void) | |||
66 | 66 | ||
67 | static void blame_fn(void) | 67 | static void blame_fn(void) |
68 | { | 68 | { |
69 | if (ctx.cfg.enable_blame) | 69 | if (ctx.repo->enable_blame) |
70 | cgit_print_blame(); | 70 | cgit_print_blame(); |
71 | else | 71 | else |
72 | cgit_print_error_page(403, "Forbidden", "Blame is disabled"); | 72 | cgit_print_error_page(403, "Forbidden", "Blame is disabled"); |
diff --git a/shared.c b/shared.c index a2c0d03..8115469 100644 --- a/shared.c +++ b/shared.c | |||
@@ -58,6 +58,7 @@ struct cgit_repo *cgit_add_repo(const char *url) | |||
58 | ret->homepage = NULL; | 58 | ret->homepage = NULL; |
59 | ret->section = ctx.cfg.section; | 59 | ret->section = ctx.cfg.section; |
60 | ret->snapshots = ctx.cfg.snapshots; | 60 | ret->snapshots = ctx.cfg.snapshots; |
61 | ret->enable_blame = ctx.cfg.enable_blame; | ||
61 | ret->enable_commit_graph = ctx.cfg.enable_commit_graph; | 62 | ret->enable_commit_graph = ctx.cfg.enable_commit_graph; |
62 | ret->enable_log_filecount = ctx.cfg.enable_log_filecount; | 63 | ret->enable_log_filecount = ctx.cfg.enable_log_filecount; |
63 | ret->enable_log_linecount = ctx.cfg.enable_log_linecount; | 64 | ret->enable_log_linecount = ctx.cfg.enable_log_linecount; |
diff --git a/ui-tree.c b/ui-tree.c index 4be89c8..84eb17d 100644 --- a/ui-tree.c +++ b/ui-tree.c | |||
@@ -110,7 +110,7 @@ static void print_object(const struct object_id *oid, const char *path, const ch | |||
110 | htmlf("blob: %s (", oid_to_hex(oid)); | 110 | htmlf("blob: %s (", oid_to_hex(oid)); |
111 | cgit_plain_link("plain", NULL, NULL, ctx.qry.head, | 111 | cgit_plain_link("plain", NULL, NULL, ctx.qry.head, |
112 | rev, path); | 112 | rev, path); |
113 | if (ctx.cfg.enable_blame) { | 113 | if (ctx.repo->enable_blame) { |
114 | html(") ("); | 114 | html(") ("); |
115 | cgit_blame_link("blame", NULL, NULL, ctx.qry.head, | 115 | cgit_blame_link("blame", NULL, NULL, ctx.qry.head, |
116 | rev, path); | 116 | rev, path); |
@@ -251,7 +251,7 @@ static int ls_item(const struct object_id *oid, struct strbuf *base, | |||
251 | if (!S_ISGITLINK(mode)) | 251 | if (!S_ISGITLINK(mode)) |
252 | cgit_plain_link("plain", NULL, "button", ctx.qry.head, | 252 | cgit_plain_link("plain", NULL, "button", ctx.qry.head, |
253 | walk_tree_ctx->curr_rev, fullpath.buf); | 253 | walk_tree_ctx->curr_rev, fullpath.buf); |
254 | if (!S_ISDIR(mode) && ctx.cfg.enable_blame) | 254 | if (!S_ISDIR(mode) && ctx.repo->enable_blame) |
255 | cgit_blame_link("blame", NULL, "button", ctx.qry.head, | 255 | cgit_blame_link("blame", NULL, "button", ctx.qry.head, |
256 | walk_tree_ctx->curr_rev, fullpath.buf); | 256 | walk_tree_ctx->curr_rev, fullpath.buf); |
257 | html("</td></tr>\n"); | 257 | html("</td></tr>\n"); |