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
@@ -41,48 +41,50 @@ struct cgit_filter *new_filter(const char *cmd, int extra_args) | |||
41 | } | 41 | } |
42 | 42 | ||
43 | static void process_cached_repolist(const char *path); | 43 | static void process_cached_repolist(const char *path); |
44 | 44 | ||
45 | void repo_config(struct cgit_repo *repo, const char *name, const char *value) | 45 | void repo_config(struct cgit_repo *repo, const char *name, const char *value) |
46 | { | 46 | { |
47 | if (!strcmp(name, "name")) | 47 | if (!strcmp(name, "name")) |
48 | repo->name = xstrdup(value); | 48 | repo->name = xstrdup(value); |
49 | else if (!strcmp(name, "clone-url")) | 49 | else if (!strcmp(name, "clone-url")) |
50 | repo->clone_url = xstrdup(value); | 50 | repo->clone_url = xstrdup(value); |
51 | else if (!strcmp(name, "desc")) | 51 | else if (!strcmp(name, "desc")) |
52 | repo->desc = xstrdup(value); | 52 | repo->desc = xstrdup(value); |
53 | else if (!strcmp(name, "owner")) | 53 | else if (!strcmp(name, "owner")) |
54 | repo->owner = xstrdup(value); | 54 | repo->owner = xstrdup(value); |
55 | else if (!strcmp(name, "defbranch")) | 55 | else if (!strcmp(name, "defbranch")) |
56 | repo->defbranch = xstrdup(value); | 56 | repo->defbranch = xstrdup(value); |
57 | else if (!strcmp(name, "snapshots")) | 57 | else if (!strcmp(name, "snapshots")) |
58 | repo->snapshots = ctx.cfg.snapshots & cgit_parse_snapshots_mask(value); | 58 | repo->snapshots = ctx.cfg.snapshots & cgit_parse_snapshots_mask(value); |
59 | else if (!strcmp(name, "enable-log-filecount")) | 59 | else if (!strcmp(name, "enable-log-filecount")) |
60 | repo->enable_log_filecount = ctx.cfg.enable_log_filecount * atoi(value); | 60 | repo->enable_log_filecount = ctx.cfg.enable_log_filecount * atoi(value); |
61 | else if (!strcmp(name, "enable-log-linecount")) | 61 | else if (!strcmp(name, "enable-log-linecount")) |
62 | repo->enable_log_linecount = ctx.cfg.enable_log_linecount * atoi(value); | 62 | repo->enable_log_linecount = ctx.cfg.enable_log_linecount * atoi(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); |
67 | else if (!strcmp(name, "module-link")) | 69 | else if (!strcmp(name, "module-link")) |
68 | repo->module_link= xstrdup(value); | 70 | repo->module_link= xstrdup(value); |
69 | else if (!strcmp(name, "section")) | 71 | else if (!strcmp(name, "section")) |
70 | repo->section = xstrdup(value); | 72 | repo->section = xstrdup(value); |
71 | else if (!strcmp(name, "readme") && value != NULL) { | 73 | else if (!strcmp(name, "readme") && value != NULL) { |
72 | if (*value == '/') | 74 | if (*value == '/') |
73 | repo->readme = xstrdup(value); | 75 | repo->readme = xstrdup(value); |
74 | else | 76 | else |
75 | repo->readme = xstrdup(fmt("%s/%s", repo->path, value)); | 77 | repo->readme = xstrdup(fmt("%s/%s", repo->path, value)); |
76 | } else if (ctx.cfg.enable_filter_overrides) { | 78 | } else if (ctx.cfg.enable_filter_overrides) { |
77 | if (!strcmp(name, "about-filter")) | 79 | if (!strcmp(name, "about-filter")) |
78 | repo->about_filter = new_filter(value, 0); | 80 | repo->about_filter = new_filter(value, 0); |
79 | else if (!strcmp(name, "commit-filter")) | 81 | else if (!strcmp(name, "commit-filter")) |
80 | repo->commit_filter = new_filter(value, 0); | 82 | repo->commit_filter = new_filter(value, 0); |
81 | else if (!strcmp(name, "source-filter")) | 83 | else if (!strcmp(name, "source-filter")) |
82 | repo->source_filter = new_filter(value, 1); | 84 | repo->source_filter = new_filter(value, 1); |
83 | } | 85 | } |
84 | } | 86 | } |
85 | 87 | ||
86 | void config_cb(const char *name, const char *value) | 88 | void config_cb(const char *name, const char *value) |
87 | { | 89 | { |
88 | if (!strcmp(name, "section") || !strcmp(name, "repo.group")) | 90 | if (!strcmp(name, "section") || !strcmp(name, "repo.group")) |
@@ -120,48 +122,50 @@ void config_cb(const char *name, const char *value) | |||
120 | else if (!strcmp(name, "module-link")) | 122 | else if (!strcmp(name, "module-link")) |
121 | ctx.cfg.module_link = xstrdup(value); | 123 | ctx.cfg.module_link = xstrdup(value); |
122 | else if (!strcmp(name, "virtual-root")) { | 124 | else if (!strcmp(name, "virtual-root")) { |
123 | ctx.cfg.virtual_root = trim_end(value, '/'); | 125 | ctx.cfg.virtual_root = trim_end(value, '/'); |
124 | if (!ctx.cfg.virtual_root && (!strcmp(value, "/"))) | 126 | if (!ctx.cfg.virtual_root && (!strcmp(value, "/"))) |
125 | ctx.cfg.virtual_root = ""; | 127 | ctx.cfg.virtual_root = ""; |
126 | } else if (!strcmp(name, "nocache")) | 128 | } else if (!strcmp(name, "nocache")) |
127 | ctx.cfg.nocache = atoi(value); | 129 | ctx.cfg.nocache = atoi(value); |
128 | else if (!strcmp(name, "noplainemail")) | 130 | else if (!strcmp(name, "noplainemail")) |
129 | ctx.cfg.noplainemail = atoi(value); | 131 | ctx.cfg.noplainemail = atoi(value); |
130 | else if (!strcmp(name, "noheader")) | 132 | else if (!strcmp(name, "noheader")) |
131 | ctx.cfg.noheader = atoi(value); | 133 | ctx.cfg.noheader = atoi(value); |
132 | else if (!strcmp(name, "snapshots")) | 134 | else if (!strcmp(name, "snapshots")) |
133 | ctx.cfg.snapshots = cgit_parse_snapshots_mask(value); | 135 | ctx.cfg.snapshots = cgit_parse_snapshots_mask(value); |
134 | else if (!strcmp(name, "enable-filter-overrides")) | 136 | else if (!strcmp(name, "enable-filter-overrides")) |
135 | ctx.cfg.enable_filter_overrides = atoi(value); | 137 | ctx.cfg.enable_filter_overrides = atoi(value); |
136 | else if (!strcmp(name, "enable-index-links")) | 138 | else if (!strcmp(name, "enable-index-links")) |
137 | ctx.cfg.enable_index_links = atoi(value); | 139 | ctx.cfg.enable_index_links = atoi(value); |
138 | else if (!strcmp(name, "enable-log-filecount")) | 140 | else if (!strcmp(name, "enable-log-filecount")) |
139 | ctx.cfg.enable_log_filecount = atoi(value); | 141 | ctx.cfg.enable_log_filecount = atoi(value); |
140 | else if (!strcmp(name, "enable-log-linecount")) | 142 | else if (!strcmp(name, "enable-log-linecount")) |
141 | ctx.cfg.enable_log_linecount = atoi(value); | 143 | ctx.cfg.enable_log_linecount = atoi(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); |
146 | else if (!strcmp(name, "max-stats")) | 150 | else if (!strcmp(name, "max-stats")) |
147 | ctx.cfg.max_stats = cgit_find_stats_period(value, NULL); | 151 | ctx.cfg.max_stats = cgit_find_stats_period(value, NULL); |
148 | else if (!strcmp(name, "cache-size")) | 152 | else if (!strcmp(name, "cache-size")) |
149 | ctx.cfg.cache_size = atoi(value); | 153 | ctx.cfg.cache_size = atoi(value); |
150 | else if (!strcmp(name, "cache-root")) | 154 | else if (!strcmp(name, "cache-root")) |
151 | ctx.cfg.cache_root = xstrdup(value); | 155 | ctx.cfg.cache_root = xstrdup(value); |
152 | else if (!strcmp(name, "cache-root-ttl")) | 156 | else if (!strcmp(name, "cache-root-ttl")) |
153 | ctx.cfg.cache_root_ttl = atoi(value); | 157 | ctx.cfg.cache_root_ttl = atoi(value); |
154 | else if (!strcmp(name, "cache-repo-ttl")) | 158 | else if (!strcmp(name, "cache-repo-ttl")) |
155 | ctx.cfg.cache_repo_ttl = atoi(value); | 159 | ctx.cfg.cache_repo_ttl = atoi(value); |
156 | else if (!strcmp(name, "cache-scanrc-ttl")) | 160 | else if (!strcmp(name, "cache-scanrc-ttl")) |
157 | ctx.cfg.cache_scanrc_ttl = atoi(value); | 161 | ctx.cfg.cache_scanrc_ttl = atoi(value); |
158 | else if (!strcmp(name, "cache-static-ttl")) | 162 | else if (!strcmp(name, "cache-static-ttl")) |
159 | ctx.cfg.cache_static_ttl = atoi(value); | 163 | ctx.cfg.cache_static_ttl = atoi(value); |
160 | else if (!strcmp(name, "cache-dynamic-ttl")) | 164 | else if (!strcmp(name, "cache-dynamic-ttl")) |
161 | ctx.cfg.cache_dynamic_ttl = atoi(value); | 165 | ctx.cfg.cache_dynamic_ttl = atoi(value); |
162 | else if (!strcmp(name, "about-filter")) | 166 | else if (!strcmp(name, "about-filter")) |
163 | ctx.cfg.about_filter = new_filter(value, 0); | 167 | ctx.cfg.about_filter = new_filter(value, 0); |
164 | else if (!strcmp(name, "commit-filter")) | 168 | else if (!strcmp(name, "commit-filter")) |
165 | ctx.cfg.commit_filter = new_filter(value, 0); | 169 | ctx.cfg.commit_filter = new_filter(value, 0); |
166 | else if (!strcmp(name, "embedded")) | 170 | else if (!strcmp(name, "embedded")) |
167 | ctx.cfg.embedded = atoi(value); | 171 | ctx.cfg.embedded = atoi(value); |
@@ -52,48 +52,49 @@ typedef void (*linediff_fn)(char *line, int len); | |||
52 | struct cgit_filter { | 52 | struct cgit_filter { |
53 | char *cmd; | 53 | char *cmd; |
54 | char **argv; | 54 | char **argv; |
55 | int old_stdout; | 55 | int old_stdout; |
56 | int pipe_fh[2]; | 56 | int pipe_fh[2]; |
57 | int pid; | 57 | int pid; |
58 | int exitstatus; | 58 | int exitstatus; |
59 | }; | 59 | }; |
60 | 60 | ||
61 | struct cgit_repo { | 61 | struct cgit_repo { |
62 | char *url; | 62 | char *url; |
63 | char *name; | 63 | char *name; |
64 | char *path; | 64 | char *path; |
65 | char *desc; | 65 | char *desc; |
66 | char *owner; | 66 | char *owner; |
67 | char *defbranch; | 67 | char *defbranch; |
68 | char *module_link; | 68 | char *module_link; |
69 | char *readme; | 69 | char *readme; |
70 | char *section; | 70 | char *section; |
71 | char *clone_url; | 71 | char *clone_url; |
72 | int snapshots; | 72 | int snapshots; |
73 | int enable_log_filecount; | 73 | int enable_log_filecount; |
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; |
78 | struct cgit_filter *about_filter; | 79 | struct cgit_filter *about_filter; |
79 | struct cgit_filter *commit_filter; | 80 | struct cgit_filter *commit_filter; |
80 | struct cgit_filter *source_filter; | 81 | struct cgit_filter *source_filter; |
81 | }; | 82 | }; |
82 | 83 | ||
83 | typedef void (*repo_config_fn)(struct cgit_repo *repo, const char *name, | 84 | typedef void (*repo_config_fn)(struct cgit_repo *repo, const char *name, |
84 | const char *value); | 85 | const char *value); |
85 | 86 | ||
86 | struct cgit_repolist { | 87 | struct cgit_repolist { |
87 | int length; | 88 | int length; |
88 | int count; | 89 | int count; |
89 | struct cgit_repo *repos; | 90 | struct cgit_repo *repos; |
90 | }; | 91 | }; |
91 | 92 | ||
92 | struct commitinfo { | 93 | struct commitinfo { |
93 | struct commit *commit; | 94 | struct commit *commit; |
94 | char *author; | 95 | char *author; |
95 | char *author_email; | 96 | char *author_email; |
96 | unsigned long author_date; | 97 | unsigned long author_date; |
97 | char *committer; | 98 | char *committer; |
98 | char *committer_email; | 99 | char *committer_email; |
99 | unsigned long committer_date; | 100 | unsigned long committer_date; |
@@ -160,48 +161,49 @@ struct cgit_config { | |||
160 | char *index_info; | 161 | char *index_info; |
161 | char *logo; | 162 | char *logo; |
162 | char *logo_link; | 163 | char *logo_link; |
163 | char *module_link; | 164 | char *module_link; |
164 | char *robots; | 165 | char *robots; |
165 | char *root_title; | 166 | char *root_title; |
166 | char *root_desc; | 167 | char *root_desc; |
167 | char *root_readme; | 168 | char *root_readme; |
168 | char *script_name; | 169 | char *script_name; |
169 | char *section; | 170 | char *section; |
170 | char *virtual_root; | 171 | char *virtual_root; |
171 | int cache_size; | 172 | int cache_size; |
172 | int cache_dynamic_ttl; | 173 | int cache_dynamic_ttl; |
173 | int cache_max_create_time; | 174 | int cache_max_create_time; |
174 | int cache_repo_ttl; | 175 | int cache_repo_ttl; |
175 | int cache_root_ttl; | 176 | int cache_root_ttl; |
176 | int cache_scanrc_ttl; | 177 | int cache_scanrc_ttl; |
177 | int cache_static_ttl; | 178 | int cache_static_ttl; |
178 | int embedded; | 179 | int embedded; |
179 | int enable_filter_overrides; | 180 | int enable_filter_overrides; |
180 | int enable_index_links; | 181 | int enable_index_links; |
181 | int enable_log_filecount; | 182 | int enable_log_filecount; |
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; |
186 | int max_repo_count; | 188 | int max_repo_count; |
187 | int max_commit_count; | 189 | int max_commit_count; |
188 | int max_lock_attempts; | 190 | int max_lock_attempts; |
189 | int max_msg_len; | 191 | int max_msg_len; |
190 | int max_repodesc_len; | 192 | int max_repodesc_len; |
191 | int max_blob_size; | 193 | int max_blob_size; |
192 | int max_stats; | 194 | int max_stats; |
193 | int nocache; | 195 | int nocache; |
194 | int noplainemail; | 196 | int noplainemail; |
195 | int noheader; | 197 | int noheader; |
196 | int renamelimit; | 198 | int renamelimit; |
197 | int snapshots; | 199 | int snapshots; |
198 | int summary_branches; | 200 | int summary_branches; |
199 | int summary_log; | 201 | int summary_log; |
200 | int summary_tags; | 202 | int summary_tags; |
201 | int ssdiff; | 203 | int ssdiff; |
202 | struct string_list mimetypes; | 204 | struct string_list mimetypes; |
203 | struct cgit_filter *about_filter; | 205 | struct cgit_filter *about_filter; |
204 | struct cgit_filter *commit_filter; | 206 | struct cgit_filter *commit_filter; |
205 | struct cgit_filter *source_filter; | 207 | struct cgit_filter *source_filter; |
206 | }; | 208 | }; |
207 | 209 | ||
diff --git a/cgitrc.5.txt b/cgitrc.5.txt index d74d9e7..fcd4308 100644 --- a/cgitrc.5.txt +++ b/cgitrc.5.txt | |||
@@ -94,48 +94,54 @@ embedded:: | |||
94 | enable-filter-overrides:: | 94 | enable-filter-overrides:: |
95 | Flag which, when set to "1", allows all filter settings to be | 95 | Flag which, when set to "1", allows all filter settings to be |
96 | overridden in repository-specific cgitrc files. Default value: none. | 96 | overridden in repository-specific cgitrc files. Default value: none. |
97 | 97 | ||
98 | enable-index-links:: | 98 | enable-index-links:: |
99 | Flag which, when set to "1", will make cgit generate extra links for | 99 | Flag which, when set to "1", will make cgit generate extra links for |
100 | each repo in the repository index (specifically, to the "summary", | 100 | each repo in the repository index (specifically, to the "summary", |
101 | "commit" and "tree" pages). Default value: "0". | 101 | "commit" and "tree" pages). Default value: "0". |
102 | 102 | ||
103 | enable-log-filecount:: | 103 | enable-log-filecount:: |
104 | Flag which, when set to "1", will make cgit print the number of | 104 | Flag which, when set to "1", will make cgit print the number of |
105 | modified files for each commit on the repository log page. Default | 105 | modified files for each commit on the repository log page. Default |
106 | value: "0". | 106 | value: "0". |
107 | 107 | ||
108 | enable-log-linecount:: | 108 | enable-log-linecount:: |
109 | Flag which, when set to "1", will make cgit print the number of added | 109 | Flag which, when set to "1", will make cgit print the number of added |
110 | and removed lines for each commit on the repository log page. Default | 110 | and removed lines for each commit on the repository log page. Default |
111 | value: "0". | 111 | value: "0". |
112 | 112 | ||
113 | enable-remote-branches:: | 113 | enable-remote-branches:: |
114 | Flag which, when set to "1", will make cgit display remote branches | 114 | Flag which, when set to "1", will make cgit display remote branches |
115 | in the summary and refs views. Default value: "0". See also: | 115 | in the summary and refs views. Default value: "0". See also: |
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 |
120 | for plaintext blobs printed in the tree view. Default value: "1". | 126 | for plaintext blobs printed in the tree view. Default value: "1". |
121 | 127 | ||
122 | favicon:: | 128 | favicon:: |
123 | Url used as link to a shortcut icon for cgit. If specified, it is | 129 | Url used as link to a shortcut icon for cgit. If specified, it is |
124 | suggested to use the value "/favicon.ico" since certain browsers will | 130 | suggested to use the value "/favicon.ico" since certain browsers will |
125 | ignore other values. Default value: none. | 131 | ignore other values. Default value: none. |
126 | 132 | ||
127 | footer:: | 133 | footer:: |
128 | The content of the file specified with this option will be included | 134 | The content of the file specified with this option will be included |
129 | verbatim at the bottom of all pages (i.e. it replaces the standard | 135 | verbatim at the bottom of all pages (i.e. it replaces the standard |
130 | "generated by..." message. Default value: none. | 136 | "generated by..." message. Default value: none. |
131 | 137 | ||
132 | head-include:: | 138 | head-include:: |
133 | The content of the file specified with this option will be included | 139 | The content of the file specified with this option will be included |
134 | verbatim in the html HEAD section on all pages. Default value: none. | 140 | verbatim in the html HEAD section on all pages. Default value: none. |
135 | 141 | ||
136 | header:: | 142 | header:: |
137 | The content of the file specified with this option will be included | 143 | The content of the file specified with this option will be included |
138 | verbatim at the top of all pages. Default value: none. | 144 | verbatim at the top of all pages. Default value: none. |
139 | 145 | ||
140 | include:: | 146 | include:: |
141 | Name of a configfile to include before the rest of the current config- | 147 | Name of a configfile to include before the rest of the current config- |
@@ -300,48 +306,52 @@ repo.clone-url:: | |||
300 | repo.commit-filter:: | 306 | repo.commit-filter:: |
301 | Override the default commit-filter. Default value: none. See also: | 307 | Override the default commit-filter. Default value: none. See also: |
302 | "enable-filter-overrides". | 308 | "enable-filter-overrides". |
303 | 309 | ||
304 | repo.defbranch:: | 310 | repo.defbranch:: |
305 | The name of the default branch for this repository. If no such branch | 311 | The name of the default branch for this repository. If no such branch |
306 | exists in the repository, the first branch name (when sorted) is used | 312 | exists in the repository, the first branch name (when sorted) is used |
307 | as default instead. Default value: "master". | 313 | as default instead. Default value: "master". |
308 | 314 | ||
309 | repo.desc:: | 315 | repo.desc:: |
310 | The value to show as repository description. Default value: none. | 316 | The value to show as repository description. Default value: none. |
311 | 317 | ||
312 | repo.enable-log-filecount:: | 318 | repo.enable-log-filecount:: |
313 | A flag which can be used to disable the global setting | 319 | A flag which can be used to disable the global setting |
314 | `enable-log-filecount'. Default value: none. | 320 | `enable-log-filecount'. Default value: none. |
315 | 321 | ||
316 | repo.enable-log-linecount:: | 322 | repo.enable-log-linecount:: |
317 | A flag which can be used to disable the global setting | 323 | A flag which can be used to disable the global setting |
318 | `enable-log-linecount'. Default value: none. | 324 | `enable-log-linecount'. Default value: none. |
319 | 325 | ||
320 | repo.enable-remote-branches:: | 326 | repo.enable-remote-branches:: |
321 | Flag which, when set to "1", will make cgit display remote branches | 327 | Flag which, when set to "1", will make cgit display 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 |
326 | to the values specified for the global "max-stats" setting. Default | 336 | to the values specified for the global "max-stats" setting. Default |
327 | value: none. | 337 | value: none. |
328 | 338 | ||
329 | repo.name:: | 339 | repo.name:: |
330 | The value to show as repository name. Default value: <repo.url>. | 340 | The value to show as repository name. Default value: <repo.url>. |
331 | 341 | ||
332 | repo.owner:: | 342 | repo.owner:: |
333 | A value used to identify the owner of the repository. Default value: | 343 | A value used to identify the owner of the repository. Default value: |
334 | none. | 344 | none. |
335 | 345 | ||
336 | repo.path:: | 346 | repo.path:: |
337 | An absolute path to the repository directory. For non-bare repositories | 347 | An absolute path to the repository directory. For non-bare repositories |
338 | this is the .git-directory. Default value: none. | 348 | this is the .git-directory. Default value: none. |
339 | 349 | ||
340 | repo.readme:: | 350 | repo.readme:: |
341 | A path (relative to <repo.path>) which specifies a file to include | 351 | A path (relative to <repo.path>) which specifies a file to include |
342 | verbatim as the "About" page for this repo. Default value: none. | 352 | verbatim as the "About" page for this repo. Default value: none. |
343 | 353 | ||
344 | repo.snapshots:: | 354 | repo.snapshots:: |
345 | A mask of allowed snapshot-formats for this repo, restricted by the | 355 | A mask of allowed snapshot-formats for this repo, restricted by the |
346 | "snapshots" global setting. Default value: <snapshots>. | 356 | "snapshots" global setting. Default value: <snapshots>. |
347 | 357 | ||
@@ -39,48 +39,49 @@ struct cgit_repo *cgit_add_repo(const char *url) | |||
39 | 39 | ||
40 | if (++cgit_repolist.count > cgit_repolist.length) { | 40 | if (++cgit_repolist.count > cgit_repolist.length) { |
41 | if (cgit_repolist.length == 0) | 41 | if (cgit_repolist.length == 0) |
42 | cgit_repolist.length = 8; | 42 | cgit_repolist.length = 8; |
43 | else | 43 | else |
44 | cgit_repolist.length *= 2; | 44 | cgit_repolist.length *= 2; |
45 | cgit_repolist.repos = xrealloc(cgit_repolist.repos, | 45 | cgit_repolist.repos = xrealloc(cgit_repolist.repos, |
46 | cgit_repolist.length * | 46 | cgit_repolist.length * |
47 | sizeof(struct cgit_repo)); | 47 | sizeof(struct cgit_repo)); |
48 | } | 48 | } |
49 | 49 | ||
50 | ret = &cgit_repolist.repos[cgit_repolist.count-1]; | 50 | ret = &cgit_repolist.repos[cgit_repolist.count-1]; |
51 | memset(ret, 0, sizeof(struct cgit_repo)); | 51 | memset(ret, 0, sizeof(struct cgit_repo)); |
52 | ret->url = trim_end(url, '/'); | 52 | ret->url = trim_end(url, '/'); |
53 | ret->name = ret->url; | 53 | ret->name = ret->url; |
54 | ret->path = NULL; | 54 | ret->path = NULL; |
55 | ret->desc = "[no description]"; | 55 | ret->desc = "[no description]"; |
56 | ret->owner = NULL; | 56 | ret->owner = NULL; |
57 | ret->section = ctx.cfg.section; | 57 | ret->section = ctx.cfg.section; |
58 | ret->defbranch = "master"; | 58 | ret->defbranch = "master"; |
59 | ret->snapshots = ctx.cfg.snapshots; | 59 | ret->snapshots = ctx.cfg.snapshots; |
60 | ret->enable_log_filecount = ctx.cfg.enable_log_filecount; | 60 | ret->enable_log_filecount = ctx.cfg.enable_log_filecount; |
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; |
65 | ret->readme = NULL; | 66 | ret->readme = NULL; |
66 | ret->mtime = -1; | 67 | ret->mtime = -1; |
67 | ret->about_filter = ctx.cfg.about_filter; | 68 | ret->about_filter = ctx.cfg.about_filter; |
68 | ret->commit_filter = ctx.cfg.commit_filter; | 69 | ret->commit_filter = ctx.cfg.commit_filter; |
69 | ret->source_filter = ctx.cfg.source_filter; | 70 | ret->source_filter = ctx.cfg.source_filter; |
70 | return ret; | 71 | return ret; |
71 | } | 72 | } |
72 | 73 | ||
73 | struct cgit_repo *cgit_get_repoinfo(const char *url) | 74 | struct cgit_repo *cgit_get_repoinfo(const char *url) |
74 | { | 75 | { |
75 | int i; | 76 | int i; |
76 | struct cgit_repo *repo; | 77 | struct cgit_repo *repo; |
77 | 78 | ||
78 | for (i=0; i<cgit_repolist.count; i++) { | 79 | for (i=0; i<cgit_repolist.count; i++) { |
79 | repo = &cgit_repolist.repos[i]; | 80 | repo = &cgit_repolist.repos[i]; |
80 | if (!strcmp(repo->url, url)) | 81 | if (!strcmp(repo->url, url)) |
81 | return repo; | 82 | return repo; |
82 | } | 83 | } |
83 | return NULL; | 84 | return NULL; |
84 | } | 85 | } |
85 | 86 | ||
86 | void *cgit_free_commitinfo(struct commitinfo *info) | 87 | void *cgit_free_commitinfo(struct commitinfo *info) |
diff --git a/ui-commit.c b/ui-commit.c index 4d4970f..41313b9 100644 --- a/ui-commit.c +++ b/ui-commit.c | |||
@@ -1,45 +1,45 @@ | |||
1 | /* ui-commit.c: generate commit view | 1 | /* ui-commit.c: generate commit view |
2 | * | 2 | * |
3 | * Copyright (C) 2006 Lars Hjemli | 3 | * Copyright (C) 2006 Lars Hjemli |
4 | * | 4 | * |
5 | * Licensed under GNU General Public License v2 | 5 | * Licensed under GNU General Public License v2 |
6 | * (see COPYING for full license text) | 6 | * (see COPYING for full license text) |
7 | */ | 7 | */ |
8 | 8 | ||
9 | #include "cgit.h" | 9 | #include "cgit.h" |
10 | #include "html.h" | 10 | #include "html.h" |
11 | #include "ui-shared.h" | 11 | #include "ui-shared.h" |
12 | #include "ui-diff.h" | 12 | #include "ui-diff.h" |
13 | #include "ui-log.h" | 13 | #include "ui-log.h" |
14 | 14 | ||
15 | void cgit_print_commit(char *hex) | 15 | void cgit_print_commit(char *hex) |
16 | { | 16 | { |
17 | struct commit *commit, *parent; | 17 | struct commit *commit, *parent; |
18 | struct commitinfo *info, *parent_info; | 18 | struct commitinfo *info, *parent_info; |
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 | ||
24 | if (!hex) | 24 | if (!hex) |
25 | hex = ctx.qry.head; | 25 | hex = ctx.qry.head; |
26 | 26 | ||
27 | if (get_sha1(hex, sha1)) { | 27 | if (get_sha1(hex, sha1)) { |
28 | cgit_print_error(fmt("Bad object id: %s", hex)); | 28 | cgit_print_error(fmt("Bad object id: %s", hex)); |
29 | return; | 29 | return; |
30 | } | 30 | } |
31 | commit = lookup_commit_reference(sha1); | 31 | commit = lookup_commit_reference(sha1); |
32 | if (!commit) { | 32 | if (!commit) { |
33 | cgit_print_error(fmt("Bad commit reference: %s", hex)); | 33 | cgit_print_error(fmt("Bad commit reference: %s", hex)); |
34 | return; | 34 | return; |
35 | } | 35 | } |
36 | info = cgit_parse_commit(commit); | 36 | info = cgit_parse_commit(commit); |
37 | 37 | ||
38 | load_ref_decorations(DECORATE_FULL_REFS); | 38 | load_ref_decorations(DECORATE_FULL_REFS); |
39 | 39 | ||
40 | html("<table summary='commit info' class='commit-info'>\n"); | 40 | html("<table summary='commit info' class='commit-info'>\n"); |
41 | html("<tr><th>author</th><td>"); | 41 | html("<tr><th>author</th><td>"); |
42 | html_txt(info->author); | 42 | html_txt(info->author); |
43 | if (!ctx.cfg.noplainemail) { | 43 | if (!ctx.cfg.noplainemail) { |
44 | html(" "); | 44 | html(" "); |
45 | html_txt(info->author_email); | 45 | html_txt(info->author_email); |
@@ -61,52 +61,54 @@ void cgit_print_commit(char *hex) | |||
61 | cgit_commit_link(tmp, NULL, NULL, ctx.qry.head, tmp, 0); | 61 | cgit_commit_link(tmp, NULL, NULL, ctx.qry.head, tmp, 0); |
62 | html(" ("); | 62 | html(" ("); |
63 | cgit_patch_link("patch", NULL, NULL, NULL, tmp); | 63 | cgit_patch_link("patch", NULL, NULL, NULL, tmp); |
64 | html(") ("); | 64 | html(") ("); |
65 | if ((ctx.qry.ssdiff && !ctx.cfg.ssdiff) || (!ctx.qry.ssdiff && ctx.cfg.ssdiff)) | 65 | if ((ctx.qry.ssdiff && !ctx.cfg.ssdiff) || (!ctx.qry.ssdiff && ctx.cfg.ssdiff)) |
66 | cgit_commit_link("unidiff", NULL, NULL, ctx.qry.head, tmp, 1); | 66 | cgit_commit_link("unidiff", NULL, NULL, ctx.qry.head, tmp, 1); |
67 | else | 67 | else |
68 | cgit_commit_link("side-by-side diff", NULL, NULL, ctx.qry.head, tmp, 1); | 68 | cgit_commit_link("side-by-side diff", NULL, NULL, ctx.qry.head, tmp, 1); |
69 | html(")</td></tr>\n"); | 69 | html(")</td></tr>\n"); |
70 | html("<tr><th>tree</th><td colspan='2' class='sha1'>"); | 70 | html("<tr><th>tree</th><td colspan='2' class='sha1'>"); |
71 | tmp = xstrdup(hex); | 71 | tmp = xstrdup(hex); |
72 | cgit_tree_link(sha1_to_hex(commit->tree->object.sha1), NULL, NULL, | 72 | cgit_tree_link(sha1_to_hex(commit->tree->object.sha1), NULL, NULL, |
73 | ctx.qry.head, tmp, NULL); | 73 | ctx.qry.head, tmp, NULL); |
74 | html("</td></tr>\n"); | 74 | html("</td></tr>\n"); |
75 | for (p = commit->parents; p ; p = p->next) { | 75 | for (p = commit->parents; p ; p = p->next) { |
76 | parent = lookup_commit_reference(p->item->object.sha1); | 76 | parent = lookup_commit_reference(p->item->object.sha1); |
77 | if (!parent) { | 77 | if (!parent) { |
78 | html("<tr><td colspan='3'>"); | 78 | html("<tr><td colspan='3'>"); |
79 | cgit_print_error("Error reading parent commit"); | 79 | cgit_print_error("Error reading parent commit"); |
80 | html("</td></tr>"); | 80 | html("</td></tr>"); |
81 | continue; | 81 | continue; |
82 | } | 82 | } |
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, |
91 | sha1_to_hex(p->item->object.sha1), NULL, 0); | 93 | sha1_to_hex(p->item->object.sha1), NULL, 0); |
92 | html(")</td></tr>"); | 94 | html(")</td></tr>"); |
93 | parents++; | 95 | parents++; |
94 | } | 96 | } |
95 | if (ctx.repo->snapshots) { | 97 | if (ctx.repo->snapshots) { |
96 | html("<tr><th>download</th><td colspan='2' class='sha1'>"); | 98 | html("<tr><th>download</th><td colspan='2' class='sha1'>"); |
97 | cgit_print_snapshot_links(ctx.qry.repo, ctx.qry.head, | 99 | cgit_print_snapshot_links(ctx.qry.repo, ctx.qry.head, |
98 | hex, ctx.repo->snapshots); | 100 | hex, ctx.repo->snapshots); |
99 | html("</td></tr>"); | 101 | html("</td></tr>"); |
100 | } | 102 | } |
101 | html("</table>\n"); | 103 | html("</table>\n"); |
102 | html("<div class='commit-subject'>"); | 104 | html("<div class='commit-subject'>"); |
103 | if (ctx.repo->commit_filter) | 105 | if (ctx.repo->commit_filter) |
104 | cgit_open_filter(ctx.repo->commit_filter); | 106 | cgit_open_filter(ctx.repo->commit_filter); |
105 | html_txt(info->subject); | 107 | html_txt(info->subject); |
106 | if (ctx.repo->commit_filter) | 108 | if (ctx.repo->commit_filter) |
107 | cgit_close_filter(ctx.repo->commit_filter); | 109 | cgit_close_filter(ctx.repo->commit_filter); |
108 | show_commit_decorations(commit); | 110 | show_commit_decorations(commit); |
109 | html("</div>"); | 111 | html("</div>"); |
110 | html("<div class='commit-msg'>"); | 112 | html("<div class='commit-msg'>"); |
111 | if (ctx.repo->commit_filter) | 113 | if (ctx.repo->commit_filter) |
112 | cgit_open_filter(ctx.repo->commit_filter); | 114 | cgit_open_filter(ctx.repo->commit_filter); |