mirror of
https://git.zx2c4.com/cgit
synced 2024-11-25 09:58:41 +00:00
Merge branch 'sn/subject-link'
This commit is contained in:
commit
9af580d8f6
4
cgit.c
4
cgit.c
@ -62,6 +62,8 @@ void repo_config(struct cgit_repo *repo, const char *name, const char *value)
|
|||||||
repo->enable_log_linecount = ctx.cfg.enable_log_linecount * atoi(value);
|
repo->enable_log_linecount = ctx.cfg.enable_log_linecount * atoi(value);
|
||||||
else if (!strcmp(name, "enable-remote-branches"))
|
else if (!strcmp(name, "enable-remote-branches"))
|
||||||
repo->enable_remote_branches = atoi(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"))
|
else if (!strcmp(name, "max-stats"))
|
||||||
repo->max_stats = cgit_find_stats_period(value, NULL);
|
repo->max_stats = cgit_find_stats_period(value, NULL);
|
||||||
else if (!strcmp(name, "module-link"))
|
else if (!strcmp(name, "module-link"))
|
||||||
@ -141,6 +143,8 @@ void config_cb(const char *name, const char *value)
|
|||||||
ctx.cfg.enable_log_linecount = atoi(value);
|
ctx.cfg.enable_log_linecount = atoi(value);
|
||||||
else if (!strcmp(name, "enable-remote-branches"))
|
else if (!strcmp(name, "enable-remote-branches"))
|
||||||
ctx.cfg.enable_remote_branches = atoi(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"))
|
else if (!strcmp(name, "enable-tree-linenumbers"))
|
||||||
ctx.cfg.enable_tree_linenumbers = atoi(value);
|
ctx.cfg.enable_tree_linenumbers = atoi(value);
|
||||||
else if (!strcmp(name, "max-stats"))
|
else if (!strcmp(name, "max-stats"))
|
||||||
|
2
cgit.h
2
cgit.h
@ -73,6 +73,7 @@ struct cgit_repo {
|
|||||||
int enable_log_filecount;
|
int enable_log_filecount;
|
||||||
int enable_log_linecount;
|
int enable_log_linecount;
|
||||||
int enable_remote_branches;
|
int enable_remote_branches;
|
||||||
|
int enable_subject_links;
|
||||||
int max_stats;
|
int max_stats;
|
||||||
time_t mtime;
|
time_t mtime;
|
||||||
struct cgit_filter *about_filter;
|
struct cgit_filter *about_filter;
|
||||||
@ -181,6 +182,7 @@ struct cgit_config {
|
|||||||
int enable_log_filecount;
|
int enable_log_filecount;
|
||||||
int enable_log_linecount;
|
int enable_log_linecount;
|
||||||
int enable_remote_branches;
|
int enable_remote_branches;
|
||||||
|
int enable_subject_links;
|
||||||
int enable_tree_linenumbers;
|
int enable_tree_linenumbers;
|
||||||
int local_time;
|
int local_time;
|
||||||
int max_repo_count;
|
int max_repo_count;
|
||||||
|
10
cgitrc.5.txt
10
cgitrc.5.txt
@ -115,6 +115,12 @@ enable-remote-branches::
|
|||||||
in the summary and refs views. Default value: "0". See also:
|
in the summary and refs views. Default value: "0". See also:
|
||||||
"repo.enable-remote-branches".
|
"repo.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::
|
enable-tree-linenumbers::
|
||||||
Flag which, when set to "1", will make cgit generate linenumber links
|
Flag which, when set to "1", will make cgit generate linenumber links
|
||||||
for plaintext blobs printed in the tree view. Default value: "1".
|
for plaintext blobs printed in the tree view. Default value: "1".
|
||||||
@ -321,6 +327,10 @@ repo.enable-remote-branches::
|
|||||||
Flag which, when set to "1", will make cgit display remote branches
|
Flag which, when set to "1", will make cgit display remote branches
|
||||||
in the summary and refs views. Default value: <enable-remote-branches>.
|
in the summary and refs views. Default value: <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::
|
repo.max-stats::
|
||||||
Override the default maximum statistics period. Valid values are equal
|
Override the default maximum statistics period. Valid values are equal
|
||||||
to the values specified for the global "max-stats" setting. Default
|
to the values specified for the global "max-stats" setting. Default
|
||||||
|
1
shared.c
1
shared.c
@ -60,6 +60,7 @@ struct cgit_repo *cgit_add_repo(const char *url)
|
|||||||
ret->enable_log_filecount = ctx.cfg.enable_log_filecount;
|
ret->enable_log_filecount = ctx.cfg.enable_log_filecount;
|
||||||
ret->enable_log_linecount = ctx.cfg.enable_log_linecount;
|
ret->enable_log_linecount = ctx.cfg.enable_log_linecount;
|
||||||
ret->enable_remote_branches = ctx.cfg.enable_remote_branches;
|
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;
|
ret->max_stats = ctx.cfg.max_stats;
|
||||||
ret->module_link = ctx.cfg.module_link;
|
ret->module_link = ctx.cfg.module_link;
|
||||||
ret->readme = NULL;
|
ret->readme = NULL;
|
||||||
|
12
ui-commit.c
12
ui-commit.c
@ -15,10 +15,10 @@
|
|||||||
void cgit_print_commit(char *hex)
|
void cgit_print_commit(char *hex)
|
||||||
{
|
{
|
||||||
struct commit *commit, *parent;
|
struct commit *commit, *parent;
|
||||||
struct commitinfo *info;
|
struct commitinfo *info, *parent_info;
|
||||||
struct commit_list *p;
|
struct commit_list *p;
|
||||||
unsigned char sha1[20];
|
unsigned char sha1[20];
|
||||||
char *tmp;
|
char *tmp, *tmp2;
|
||||||
int parents = 0;
|
int parents = 0;
|
||||||
|
|
||||||
if (!hex)
|
if (!hex)
|
||||||
@ -82,8 +82,12 @@ void cgit_print_commit(char *hex)
|
|||||||
}
|
}
|
||||||
html("<tr><th>parent</th>"
|
html("<tr><th>parent</th>"
|
||||||
"<td colspan='2' class='sha1'>");
|
"<td colspan='2' class='sha1'>");
|
||||||
cgit_commit_link(sha1_to_hex(p->item->object.sha1), NULL, NULL,
|
tmp = tmp2 = sha1_to_hex(p->item->object.sha1);
|
||||||
ctx.qry.head, sha1_to_hex(p->item->object.sha1), 0);
|
if (ctx.repo->enable_subject_links) {
|
||||||
|
parent_info = cgit_parse_commit(parent);
|
||||||
|
tmp2 = parent_info->subject;
|
||||||
|
}
|
||||||
|
cgit_commit_link(tmp2, NULL, NULL, ctx.qry.head, tmp, 0);
|
||||||
html(" (");
|
html(" (");
|
||||||
cgit_diff_link("diff", NULL, NULL, ctx.qry.head, hex,
|
cgit_diff_link("diff", NULL, NULL, ctx.qry.head, hex,
|
||||||
sha1_to_hex(p->item->object.sha1), NULL, 0);
|
sha1_to_hex(p->item->object.sha1), NULL, 0);
|
||||||
|
Loading…
Reference in New Issue
Block a user