author | Ragnar Ouchterlony <ragnar@lysator.liu.se> | 2009-09-14 18:19:02 (UTC) |
---|---|---|
committer | Lars Hjemli <hjemli@gmail.com> | 2009-09-16 18:17:56 (UTC) |
commit | c358aa3dfebf4fc1f3005dd960aa5c1c020eed76 (patch) (unidiff) | |
tree | 475fa421d673b270c7d1bde872b96425abfafce8 /cgit.h | |
parent | 40e174d5364910750413d94b5417e57d108190ef (diff) | |
download | cgit-c358aa3dfebf4fc1f3005dd960aa5c1c020eed76.zip cgit-c358aa3dfebf4fc1f3005dd960aa5c1c020eed76.tar.gz cgit-c358aa3dfebf4fc1f3005dd960aa5c1c020eed76.tar.bz2 |
Add possibility to switch between unidiff and side-by-side-diff.
A new config option side-by-side-diffs added, defaulting to 0,
meaning unidiff. Also a query option (ss) is used toggle this.
In the commit page you can switch between the two diff formats by
clicking on the link on the "commit"-row, to the right of (patch).
In the diff page you can switch by using the link at the start
of the page.
All commit-links and diff-links will remember the choice.
Signed-off-by: Ragnar Ouchterlony <ragnar@lysator.liu.se>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
-rw-r--r-- | cgit.h | 2 |
1 files changed, 2 insertions, 0 deletions
@@ -82,179 +82,181 @@ struct cgit_repo { | |||
82 | typedef void (*repo_config_fn)(struct cgit_repo *repo, const char *name, | 82 | typedef void (*repo_config_fn)(struct cgit_repo *repo, const char *name, |
83 | const char *value); | 83 | const char *value); |
84 | 84 | ||
85 | struct cgit_repolist { | 85 | struct cgit_repolist { |
86 | int length; | 86 | int length; |
87 | int count; | 87 | int count; |
88 | struct cgit_repo *repos; | 88 | struct cgit_repo *repos; |
89 | }; | 89 | }; |
90 | 90 | ||
91 | struct commitinfo { | 91 | struct commitinfo { |
92 | struct commit *commit; | 92 | struct commit *commit; |
93 | char *author; | 93 | char *author; |
94 | char *author_email; | 94 | char *author_email; |
95 | unsigned long author_date; | 95 | unsigned long author_date; |
96 | char *committer; | 96 | char *committer; |
97 | char *committer_email; | 97 | char *committer_email; |
98 | unsigned long committer_date; | 98 | unsigned long committer_date; |
99 | char *subject; | 99 | char *subject; |
100 | char *msg; | 100 | char *msg; |
101 | char *msg_encoding; | 101 | char *msg_encoding; |
102 | }; | 102 | }; |
103 | 103 | ||
104 | struct taginfo { | 104 | struct taginfo { |
105 | char *tagger; | 105 | char *tagger; |
106 | char *tagger_email; | 106 | char *tagger_email; |
107 | unsigned long tagger_date; | 107 | unsigned long tagger_date; |
108 | char *msg; | 108 | char *msg; |
109 | }; | 109 | }; |
110 | 110 | ||
111 | struct refinfo { | 111 | struct refinfo { |
112 | const char *refname; | 112 | const char *refname; |
113 | struct object *object; | 113 | struct object *object; |
114 | union { | 114 | union { |
115 | struct taginfo *tag; | 115 | struct taginfo *tag; |
116 | struct commitinfo *commit; | 116 | struct commitinfo *commit; |
117 | }; | 117 | }; |
118 | }; | 118 | }; |
119 | 119 | ||
120 | struct reflist { | 120 | struct reflist { |
121 | struct refinfo **refs; | 121 | struct refinfo **refs; |
122 | int alloc; | 122 | int alloc; |
123 | int count; | 123 | int count; |
124 | }; | 124 | }; |
125 | 125 | ||
126 | struct cgit_query { | 126 | struct cgit_query { |
127 | int has_symref; | 127 | int has_symref; |
128 | int has_sha1; | 128 | int has_sha1; |
129 | char *raw; | 129 | char *raw; |
130 | char *repo; | 130 | char *repo; |
131 | char *page; | 131 | char *page; |
132 | char *search; | 132 | char *search; |
133 | char *grep; | 133 | char *grep; |
134 | char *head; | 134 | char *head; |
135 | char *sha1; | 135 | char *sha1; |
136 | char *sha2; | 136 | char *sha2; |
137 | char *path; | 137 | char *path; |
138 | char *name; | 138 | char *name; |
139 | char *mimetype; | 139 | char *mimetype; |
140 | char *url; | 140 | char *url; |
141 | char *period; | 141 | char *period; |
142 | int ofs; | 142 | int ofs; |
143 | int nohead; | 143 | int nohead; |
144 | char *sort; | 144 | char *sort; |
145 | int showmsg; | 145 | int showmsg; |
146 | int ssdiff; | ||
146 | }; | 147 | }; |
147 | 148 | ||
148 | struct cgit_config { | 149 | struct cgit_config { |
149 | char *agefile; | 150 | char *agefile; |
150 | char *cache_root; | 151 | char *cache_root; |
151 | char *clone_prefix; | 152 | char *clone_prefix; |
152 | char *css; | 153 | char *css; |
153 | char *favicon; | 154 | char *favicon; |
154 | char *footer; | 155 | char *footer; |
155 | char *head_include; | 156 | char *head_include; |
156 | char *header; | 157 | char *header; |
157 | char *index_header; | 158 | char *index_header; |
158 | char *index_info; | 159 | char *index_info; |
159 | char *logo; | 160 | char *logo; |
160 | char *logo_link; | 161 | char *logo_link; |
161 | char *module_link; | 162 | char *module_link; |
162 | char *robots; | 163 | char *robots; |
163 | char *root_title; | 164 | char *root_title; |
164 | char *root_desc; | 165 | char *root_desc; |
165 | char *root_readme; | 166 | char *root_readme; |
166 | char *script_name; | 167 | char *script_name; |
167 | char *section; | 168 | char *section; |
168 | char *virtual_root; | 169 | char *virtual_root; |
169 | int cache_size; | 170 | int cache_size; |
170 | int cache_dynamic_ttl; | 171 | int cache_dynamic_ttl; |
171 | int cache_max_create_time; | 172 | int cache_max_create_time; |
172 | int cache_repo_ttl; | 173 | int cache_repo_ttl; |
173 | int cache_root_ttl; | 174 | int cache_root_ttl; |
174 | int cache_scanrc_ttl; | 175 | int cache_scanrc_ttl; |
175 | int cache_static_ttl; | 176 | int cache_static_ttl; |
176 | int embedded; | 177 | int embedded; |
177 | int enable_filter_overrides; | 178 | int enable_filter_overrides; |
178 | int enable_index_links; | 179 | int enable_index_links; |
179 | int enable_log_filecount; | 180 | int enable_log_filecount; |
180 | int enable_log_linecount; | 181 | int enable_log_linecount; |
181 | int enable_tree_linenumbers; | 182 | int enable_tree_linenumbers; |
182 | int local_time; | 183 | int local_time; |
183 | int max_repo_count; | 184 | int max_repo_count; |
184 | int max_commit_count; | 185 | int max_commit_count; |
185 | int max_lock_attempts; | 186 | int max_lock_attempts; |
186 | int max_msg_len; | 187 | int max_msg_len; |
187 | int max_repodesc_len; | 188 | int max_repodesc_len; |
188 | int max_stats; | 189 | int max_stats; |
189 | int nocache; | 190 | int nocache; |
190 | int noplainemail; | 191 | int noplainemail; |
191 | int noheader; | 192 | int noheader; |
192 | int renamelimit; | 193 | int renamelimit; |
193 | int snapshots; | 194 | int snapshots; |
194 | int summary_branches; | 195 | int summary_branches; |
195 | int summary_log; | 196 | int summary_log; |
196 | int summary_tags; | 197 | int summary_tags; |
198 | int ssdiff; | ||
197 | struct string_list mimetypes; | 199 | struct string_list mimetypes; |
198 | struct cgit_filter *about_filter; | 200 | struct cgit_filter *about_filter; |
199 | struct cgit_filter *commit_filter; | 201 | struct cgit_filter *commit_filter; |
200 | struct cgit_filter *source_filter; | 202 | struct cgit_filter *source_filter; |
201 | }; | 203 | }; |
202 | 204 | ||
203 | struct cgit_page { | 205 | struct cgit_page { |
204 | time_t modified; | 206 | time_t modified; |
205 | time_t expires; | 207 | time_t expires; |
206 | size_t size; | 208 | size_t size; |
207 | char *mimetype; | 209 | char *mimetype; |
208 | char *charset; | 210 | char *charset; |
209 | char *filename; | 211 | char *filename; |
210 | char *etag; | 212 | char *etag; |
211 | char *title; | 213 | char *title; |
212 | int status; | 214 | int status; |
213 | char *statusmsg; | 215 | char *statusmsg; |
214 | }; | 216 | }; |
215 | 217 | ||
216 | struct cgit_environment { | 218 | struct cgit_environment { |
217 | char *cgit_config; | 219 | char *cgit_config; |
218 | char *http_host; | 220 | char *http_host; |
219 | char *https; | 221 | char *https; |
220 | char *no_http; | 222 | char *no_http; |
221 | char *path_info; | 223 | char *path_info; |
222 | char *query_string; | 224 | char *query_string; |
223 | char *request_method; | 225 | char *request_method; |
224 | char *script_name; | 226 | char *script_name; |
225 | char *server_name; | 227 | char *server_name; |
226 | char *server_port; | 228 | char *server_port; |
227 | }; | 229 | }; |
228 | 230 | ||
229 | struct cgit_context { | 231 | struct cgit_context { |
230 | struct cgit_environment env; | 232 | struct cgit_environment env; |
231 | struct cgit_query qry; | 233 | struct cgit_query qry; |
232 | struct cgit_config cfg; | 234 | struct cgit_config cfg; |
233 | struct cgit_repo *repo; | 235 | struct cgit_repo *repo; |
234 | struct cgit_page page; | 236 | struct cgit_page page; |
235 | }; | 237 | }; |
236 | 238 | ||
237 | struct cgit_snapshot_format { | 239 | struct cgit_snapshot_format { |
238 | const char *suffix; | 240 | const char *suffix; |
239 | const char *mimetype; | 241 | const char *mimetype; |
240 | write_archive_fn_t write_func; | 242 | write_archive_fn_t write_func; |
241 | int bit; | 243 | int bit; |
242 | }; | 244 | }; |
243 | 245 | ||
244 | extern const char *cgit_version; | 246 | extern const char *cgit_version; |
245 | 247 | ||
246 | extern struct cgit_repolist cgit_repolist; | 248 | extern struct cgit_repolist cgit_repolist; |
247 | extern struct cgit_context ctx; | 249 | extern struct cgit_context ctx; |
248 | extern const struct cgit_snapshot_format cgit_snapshot_formats[]; | 250 | extern const struct cgit_snapshot_format cgit_snapshot_formats[]; |
249 | 251 | ||
250 | extern struct cgit_repo *cgit_add_repo(const char *url); | 252 | extern struct cgit_repo *cgit_add_repo(const char *url); |
251 | extern struct cgit_repo *cgit_get_repoinfo(const char *url); | 253 | extern struct cgit_repo *cgit_get_repoinfo(const char *url); |
252 | extern void cgit_repo_config_cb(const char *name, const char *value); | 254 | extern void cgit_repo_config_cb(const char *name, const char *value); |
253 | 255 | ||
254 | extern int chk_zero(int result, char *msg); | 256 | extern int chk_zero(int result, char *msg); |
255 | extern int chk_positive(int result, char *msg); | 257 | extern int chk_positive(int result, char *msg); |
256 | extern int chk_non_negative(int result, char *msg); | 258 | extern int chk_non_negative(int result, char *msg); |
257 | 259 | ||
258 | extern char *trim_end(const char *str, char c); | 260 | extern char *trim_end(const char *str, char c); |
259 | extern char *strlpart(char *txt, int maxlen); | 261 | extern char *strlpart(char *txt, int maxlen); |
260 | extern char *strrpart(char *txt, int maxlen); | 262 | extern char *strrpart(char *txt, int maxlen); |