author | Lars Hjemli <hjemli@gmail.com> | 2010-02-27 12:12:55 (UTC) |
---|---|---|
committer | Lars Hjemli <hjemli@gmail.com> | 2010-02-27 12:12:55 (UTC) |
commit | 581a0c2a5428917d42cbfb2b4673a2d2ebceb7d0 (patch) (unidiff) | |
tree | ed8ba775c729ea391209066aea9e58ed70ed1a5c | |
parent | e15842af627de03845b9c949f1f1596d94e3be02 (diff) | |
download | cgit-581a0c2a5428917d42cbfb2b4673a2d2ebceb7d0.zip cgit-581a0c2a5428917d42cbfb2b4673a2d2ebceb7d0.tar.gz cgit-581a0c2a5428917d42cbfb2b4673a2d2ebceb7d0.tar.bz2 |
Optionally generate verbose parent links
The new option 'enable-subject-links' must be used to enable the verbose
parent-links in commit view.
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
-rw-r--r-- | cgit.c | 4 | ||||
-rw-r--r-- | cgit.h | 2 | ||||
-rw-r--r-- | cgitrc.5.txt | 10 | ||||
-rw-r--r-- | shared.c | 1 | ||||
-rw-r--r-- | ui-commit.c | 12 |
5 files changed, 24 insertions, 5 deletions
@@ -63,4 +63,6 @@ void repo_config(struct cgit_repo *repo, const char *name, const char *value) | |||
63 | else if (!strcmp(name, "enable-remote-branches")) | 63 | else if (!strcmp(name, "enable-remote-branches")) |
64 | repo->enable_remote_branches = atoi(value); | 64 | repo->enable_remote_branches = atoi(value); |
65 | else if (!strcmp(name, "enable-subject-links")) | ||
66 | repo->enable_subject_links = atoi(value); | ||
65 | else if (!strcmp(name, "max-stats")) | 67 | else if (!strcmp(name, "max-stats")) |
66 | repo->max_stats = cgit_find_stats_period(value, NULL); | 68 | repo->max_stats = cgit_find_stats_period(value, NULL); |
@@ -142,4 +144,6 @@ void config_cb(const char *name, const char *value) | |||
142 | else if (!strcmp(name, "enable-remote-branches")) | 144 | else if (!strcmp(name, "enable-remote-branches")) |
143 | ctx.cfg.enable_remote_branches = atoi(value); | 145 | ctx.cfg.enable_remote_branches = atoi(value); |
146 | else if (!strcmp(name, "enable-subject-links")) | ||
147 | ctx.cfg.enable_subject_links = atoi(value); | ||
144 | else if (!strcmp(name, "enable-tree-linenumbers")) | 148 | else if (!strcmp(name, "enable-tree-linenumbers")) |
145 | ctx.cfg.enable_tree_linenumbers = atoi(value); | 149 | ctx.cfg.enable_tree_linenumbers = atoi(value); |
@@ -74,4 +74,5 @@ struct cgit_repo { | |||
74 | int enable_log_linecount; | 74 | int enable_log_linecount; |
75 | int enable_remote_branches; | 75 | int enable_remote_branches; |
76 | int enable_subject_links; | ||
76 | int max_stats; | 77 | int max_stats; |
77 | time_t mtime; | 78 | time_t mtime; |
@@ -182,4 +183,5 @@ struct cgit_config { | |||
182 | int enable_log_linecount; | 183 | int enable_log_linecount; |
183 | int enable_remote_branches; | 184 | int enable_remote_branches; |
185 | int enable_subject_links; | ||
184 | int enable_tree_linenumbers; | 186 | int enable_tree_linenumbers; |
185 | int local_time; | 187 | int local_time; |
diff --git a/cgitrc.5.txt b/cgitrc.5.txt index d74d9e7..fcd4308 100644 --- a/cgitrc.5.txt +++ b/cgitrc.5.txt | |||
@@ -116,4 +116,10 @@ enable-remote-branches:: | |||
116 | "repo.enable-remote-branches". | 116 | "repo.enable-remote-branches". |
117 | 117 | ||
118 | enable-subject-links:: | ||
119 | Flag which, when set to "1", will make cgit use the subject of the | ||
120 | parent commit as link text when generating links to parent commits | ||
121 | in commit view. Default value: "0". See also: | ||
122 | "repo.enable-subject-links". | ||
123 | |||
118 | enable-tree-linenumbers:: | 124 | enable-tree-linenumbers:: |
119 | Flag which, when set to "1", will make cgit generate linenumber links | 125 | Flag which, when set to "1", will make cgit generate linenumber links |
@@ -322,4 +328,8 @@ repo.enable-remote-branches:: | |||
322 | in the summary and refs views. Default value: <enable-remote-branches>. | 328 | in the summary and refs views. Default value: <enable-remote-branches>. |
323 | 329 | ||
330 | repo.enable-subject-links:: | ||
331 | A flag which can be used to override the global setting | ||
332 | `enable-subject-links'. Default value: none. | ||
333 | |||
324 | repo.max-stats:: | 334 | repo.max-stats:: |
325 | Override the default maximum statistics period. Valid values are equal | 335 | Override the default maximum statistics period. Valid values are equal |
@@ -61,4 +61,5 @@ struct cgit_repo *cgit_add_repo(const char *url) | |||
61 | ret->enable_log_linecount = ctx.cfg.enable_log_linecount; | 61 | ret->enable_log_linecount = ctx.cfg.enable_log_linecount; |
62 | ret->enable_remote_branches = ctx.cfg.enable_remote_branches; | 62 | ret->enable_remote_branches = ctx.cfg.enable_remote_branches; |
63 | ret->enable_subject_links = ctx.cfg.enable_subject_links; | ||
63 | ret->max_stats = ctx.cfg.max_stats; | 64 | ret->max_stats = ctx.cfg.max_stats; |
64 | ret->module_link = ctx.cfg.module_link; | 65 | ret->module_link = ctx.cfg.module_link; |
diff --git a/ui-commit.c b/ui-commit.c index 4d4970f..41313b9 100644 --- a/ui-commit.c +++ b/ui-commit.c | |||
@@ -19,5 +19,5 @@ void cgit_print_commit(char *hex) | |||
19 | struct commit_list *p; | 19 | struct commit_list *p; |
20 | unsigned char sha1[20]; | 20 | unsigned char sha1[20]; |
21 | char *tmp; | 21 | char *tmp, *tmp2; |
22 | int parents = 0; | 22 | int parents = 0; |
23 | 23 | ||
@@ -83,8 +83,10 @@ void cgit_print_commit(char *hex) | |||
83 | html("<tr><th>parent</th>" | 83 | html("<tr><th>parent</th>" |
84 | "<td colspan='2' class='sha1'>"); | 84 | "<td colspan='2' class='sha1'>"); |
85 | parent_info = cgit_parse_commit(parent); | 85 | tmp = tmp2 = sha1_to_hex(p->item->object.sha1); |
86 | tmp = sha1_to_hex(p->item->object.sha1); | 86 | if (ctx.repo->enable_subject_links) { |
87 | cgit_commit_link(parent_info->subject, NULL, NULL, | 87 | parent_info = cgit_parse_commit(parent); |
88 | ctx.qry.head, tmp, 0); | 88 | tmp2 = parent_info->subject; |
89 | } | ||
90 | cgit_commit_link(tmp2, NULL, NULL, ctx.qry.head, tmp, 0); | ||
89 | html(" ("); | 91 | html(" ("); |
90 | cgit_diff_link("diff", NULL, NULL, ctx.qry.head, hex, | 92 | cgit_diff_link("diff", NULL, NULL, ctx.qry.head, hex, |