summaryrefslogtreecommitdiffabout
Side-by-side diff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--cgit.c4
-rw-r--r--cgit.h2
-rw-r--r--cgitrc.5.txt10
-rw-r--r--shared.c1
-rw-r--r--ui-commit.c10
5 files changed, 23 insertions, 4 deletions
diff --git a/cgit.c b/cgit.c
index 9305d0a..6ccf4aa 100644
--- a/cgit.c
+++ b/cgit.c
@@ -64,2 +64,4 @@ void repo_config(struct cgit_repo *repo, const char *name, const char *value)
repo->enable_remote_branches = atoi(value);
+ else if (!strcmp(name, "enable-subject-links"))
+ repo->enable_subject_links = atoi(value);
else if (!strcmp(name, "max-stats"))
@@ -143,2 +145,4 @@ void config_cb(const char *name, const char *value)
ctx.cfg.enable_remote_branches = atoi(value);
+ else if (!strcmp(name, "enable-subject-links"))
+ ctx.cfg.enable_subject_links = atoi(value);
else if (!strcmp(name, "enable-tree-linenumbers"))
diff --git a/cgit.h b/cgit.h
index cd4af72..9b1e3f8 100644
--- a/cgit.h
+++ b/cgit.h
@@ -75,2 +75,3 @@ struct cgit_repo {
int enable_remote_branches;
+ int enable_subject_links;
int max_stats;
@@ -183,2 +184,3 @@ struct cgit_config {
int enable_remote_branches;
+ int enable_subject_links;
int enable_tree_linenumbers;
diff --git a/cgitrc.5.txt b/cgitrc.5.txt
index d74d9e7..fcd4308 100644
--- a/cgitrc.5.txt
+++ b/cgitrc.5.txt
@@ -117,2 +117,8 @@ enable-remote-branches::
+enable-subject-links::
+ Flag which, when set to "1", will make cgit use the subject of the
+ parent commit as link text when generating links to parent commits
+ in commit view. Default value: "0". See also:
+ "repo.enable-subject-links".
+
enable-tree-linenumbers::
@@ -323,2 +329,6 @@ repo.enable-remote-branches::
+repo.enable-subject-links::
+ A flag which can be used to override the global setting
+ `enable-subject-links'. Default value: none.
+
repo.max-stats::
diff --git a/shared.c b/shared.c
index 5f46793..83ded44 100644
--- a/shared.c
+++ b/shared.c
@@ -62,2 +62,3 @@ struct cgit_repo *cgit_add_repo(const char *url)
ret->enable_remote_branches = ctx.cfg.enable_remote_branches;
+ ret->enable_subject_links = ctx.cfg.enable_subject_links;
ret->max_stats = ctx.cfg.max_stats;
diff --git a/ui-commit.c b/ui-commit.c
index 4d4970f..41313b9 100644
--- a/ui-commit.c
+++ b/ui-commit.c
@@ -20,3 +20,3 @@ void cgit_print_commit(char *hex)
unsigned char sha1[20];
- char *tmp;
+ char *tmp, *tmp2;
int parents = 0;
@@ -84,6 +84,8 @@ void cgit_print_commit(char *hex)
"<td colspan='2' class='sha1'>");
+ tmp = tmp2 = sha1_to_hex(p->item->object.sha1);
+ if (ctx.repo->enable_subject_links) {
parent_info = cgit_parse_commit(parent);
- tmp = sha1_to_hex(p->item->object.sha1);
- cgit_commit_link(parent_info->subject, NULL, NULL,
- ctx.qry.head, tmp, 0);
+ tmp2 = parent_info->subject;
+ }
+ cgit_commit_link(tmp2, NULL, NULL, ctx.qry.head, tmp, 0);
html(" (");