diff options
-rw-r--r-- | cgit.c | 14 | ||||
-rw-r--r-- | cgit.h | 2 | ||||
-rw-r--r-- | cgitrc.5.txt | 12 | ||||
-rw-r--r-- | cmd.c | 3 | ||||
-rw-r--r-- | shared.c | 1 | ||||
-rw-r--r-- | ui-log.c | 10 | ||||
-rw-r--r-- | ui-log.h | 2 | ||||
-rw-r--r-- | ui-summary.c | 2 |
8 files changed, 40 insertions, 6 deletions
@@ -84,7 +84,12 @@ void repo_config(struct cgit_repo *repo, const char *name, const char *value) | |||
84 | repo->enable_remote_branches = atoi(value); | 84 | repo->enable_remote_branches = atoi(value); |
85 | else if (!strcmp(name, "enable-subject-links")) | 85 | else if (!strcmp(name, "enable-subject-links")) |
86 | repo->enable_subject_links = atoi(value); | 86 | repo->enable_subject_links = atoi(value); |
87 | else if (!strcmp(name, "max-stats")) | 87 | else if (!strcmp(name, "commit-sort")) { |
88 | if (!strcmp(value, "date")) | ||
89 | repo->commit_sort = 1; | ||
90 | if (!strcmp(value, "topo")) | ||
91 | repo->commit_sort = 2; | ||
92 | } else if (!strcmp(name, "max-stats")) | ||
88 | repo->max_stats = cgit_find_stats_period(value, NULL); | 93 | repo->max_stats = cgit_find_stats_period(value, NULL); |
89 | else if (!strcmp(name, "module-link")) | 94 | else if (!strcmp(name, "module-link")) |
90 | repo->module_link= xstrdup(value); | 95 | repo->module_link= xstrdup(value); |
@@ -261,7 +266,12 @@ void config_cb(const char *name, const char *value) | |||
261 | ctx.cfg.clone_url = xstrdup(value); | 266 | ctx.cfg.clone_url = xstrdup(value); |
262 | else if (!strcmp(name, "local-time")) | 267 | else if (!strcmp(name, "local-time")) |
263 | ctx.cfg.local_time = atoi(value); | 268 | ctx.cfg.local_time = atoi(value); |
264 | else if (!prefixcmp(name, "mimetype.")) | 269 | else if (!strcmp(name, "commit-sort")) { |
270 | if (!strcmp(value, "date")) | ||
271 | ctx.cfg.commit_sort = 1; | ||
272 | if (!strcmp(value, "topo")) | ||
273 | ctx.cfg.commit_sort = 2; | ||
274 | } else if (!prefixcmp(name, "mimetype.")) | ||
265 | add_mimetype(name + 9, value); | 275 | add_mimetype(name + 9, value); |
266 | else if (!strcmp(name, "include")) | 276 | else if (!strcmp(name, "include")) |
267 | parse_configfile(expand_macros(value), config_cb); | 277 | parse_configfile(expand_macros(value), config_cb); |
@@ -84,6 +84,7 @@ struct cgit_repo { | |||
84 | int enable_remote_branches; | 84 | int enable_remote_branches; |
85 | int enable_subject_links; | 85 | int enable_subject_links; |
86 | int max_stats; | 86 | int max_stats; |
87 | int commit_sort; | ||
87 | time_t mtime; | 88 | time_t mtime; |
88 | struct cgit_filter *about_filter; | 89 | struct cgit_filter *about_filter; |
89 | struct cgit_filter *commit_filter; | 90 | struct cgit_filter *commit_filter; |
@@ -231,6 +232,7 @@ struct cgit_config { | |||
231 | int summary_log; | 232 | int summary_log; |
232 | int summary_tags; | 233 | int summary_tags; |
233 | int ssdiff; | 234 | int ssdiff; |
235 | int commit_sort; | ||
234 | struct string_list mimetypes; | 236 | struct string_list mimetypes; |
235 | struct cgit_filter *about_filter; | 237 | struct cgit_filter *about_filter; |
236 | struct cgit_filter *commit_filter; | 238 | struct cgit_filter *commit_filter; |
diff --git a/cgitrc.5.txt b/cgitrc.5.txt index 78bb9fc..7d01fcd 100644 --- a/cgitrc.5.txt +++ b/cgitrc.5.txt | |||
@@ -192,6 +192,12 @@ local-time:: | |||
192 | Flag which, if set to "1", makes cgit print commit and tag times in the | 192 | Flag which, if set to "1", makes cgit print commit and tag times in the |
193 | servers timezone. Default value: "0". | 193 | servers timezone. Default value: "0". |
194 | 194 | ||
195 | commit-sort:: | ||
196 | Flag which, when set to "date", enables strict date ordering in the | ||
197 | commit log, and when set to "topo" enables strict topological | ||
198 | ordering. If unset, the default ordering of "git log" is used. Default | ||
199 | value: unset. | ||
200 | |||
195 | logo:: | 201 | logo:: |
196 | Url which specifies the source of an image which will be used as a logo | 202 | Url which specifies the source of an image which will be used as a logo |
197 | on all cgit pages. Default value: "/cgit.png". | 203 | on all cgit pages. Default value: "/cgit.png". |
@@ -435,6 +441,12 @@ repo.enable-subject-links:: | |||
435 | A flag which can be used to override the global setting | 441 | A flag which can be used to override the global setting |
436 | `enable-subject-links'. Default value: none. | 442 | `enable-subject-links'. Default value: none. |
437 | 443 | ||
444 | repo.commit-sort:: | ||
445 | Flag which, when set to "date", enables strict date ordering in the | ||
446 | commit log, and when set to "topo" enables strict topological | ||
447 | ordering. If unset, the default ordering of "git log" is used. Default | ||
448 | value: unset. | ||
449 | |||
438 | repo.logo:: | 450 | repo.logo:: |
439 | Url which specifies the source of an image which will be used as a logo | 451 | Url which specifies the source of an image which will be used as a logo |
440 | on this repo's pages. Default value: global logo. | 452 | on this repo's pages. Default value: global logo. |
@@ -68,7 +68,8 @@ static void log_fn(struct cgit_context *ctx) | |||
68 | { | 68 | { |
69 | cgit_print_log(ctx->qry.sha1, ctx->qry.ofs, ctx->cfg.max_commit_count, | 69 | cgit_print_log(ctx->qry.sha1, ctx->qry.ofs, ctx->cfg.max_commit_count, |
70 | ctx->qry.grep, ctx->qry.search, ctx->qry.path, 1, | 70 | ctx->qry.grep, ctx->qry.search, ctx->qry.path, 1, |
71 | ctx->repo->enable_commit_graph); | 71 | ctx->repo->enable_commit_graph, |
72 | ctx->repo->commit_sort); | ||
72 | } | 73 | } |
73 | 74 | ||
74 | static void ls_cache_fn(struct cgit_context *ctx) | 75 | static void ls_cache_fn(struct cgit_context *ctx) |
@@ -63,6 +63,7 @@ struct cgit_repo *cgit_add_repo(const char *url) | |||
63 | ret->enable_remote_branches = ctx.cfg.enable_remote_branches; | 63 | ret->enable_remote_branches = ctx.cfg.enable_remote_branches; |
64 | ret->enable_subject_links = ctx.cfg.enable_subject_links; | 64 | ret->enable_subject_links = ctx.cfg.enable_subject_links; |
65 | ret->max_stats = ctx.cfg.max_stats; | 65 | ret->max_stats = ctx.cfg.max_stats; |
66 | ret->commit_sort = ctx.cfg.commit_sort; | ||
66 | ret->module_link = ctx.cfg.module_link; | 67 | ret->module_link = ctx.cfg.module_link; |
67 | ret->readme = ctx.cfg.readme; | 68 | ret->readme = ctx.cfg.readme; |
68 | ret->mtime = -1; | 69 | ret->mtime = -1; |
@@ -278,7 +278,7 @@ static char *next_token(char **src) | |||
278 | } | 278 | } |
279 | 279 | ||
280 | void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *pattern, | 280 | void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *pattern, |
281 | char *path, int pager, int commit_graph) | 281 | char *path, int pager, int commit_graph, int commit_sort) |
282 | { | 282 | { |
283 | struct rev_info rev; | 283 | struct rev_info rev; |
284 | struct commit *commit; | 284 | struct commit *commit; |
@@ -327,6 +327,14 @@ void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *pattern | |||
327 | COLUMN_COLORS_HTML_MAX); | 327 | COLUMN_COLORS_HTML_MAX); |
328 | } | 328 | } |
329 | 329 | ||
330 | if (commit_sort == 1) { | ||
331 | static const char *date_order_arg = "--date-order"; | ||
332 | vector_push(&vec, &date_order_arg, 0); | ||
333 | } else if (commit_sort == 2) { | ||
334 | static const char *topo_order_arg = "--topo-order"; | ||
335 | vector_push(&vec, &topo_order_arg, 0); | ||
336 | } | ||
337 | |||
330 | if (path) { | 338 | if (path) { |
331 | arg = "--"; | 339 | arg = "--"; |
332 | vector_push(&vec, &arg, 0); | 340 | vector_push(&vec, &arg, 0); |
@@ -3,7 +3,7 @@ | |||
3 | 3 | ||
4 | extern void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, | 4 | extern void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, |
5 | char *pattern, char *path, int pager, | 5 | char *pattern, char *path, int pager, |
6 | int commit_graph); | 6 | int commit_graph, int commit_sort); |
7 | extern void show_commit_decorations(struct commit *commit); | 7 | extern void show_commit_decorations(struct commit *commit); |
8 | 8 | ||
9 | #endif /* UI_LOG_H */ | 9 | #endif /* UI_LOG_H */ |
diff --git a/ui-summary.c b/ui-summary.c index 227ed27..b4fdd57 100644 --- a/ui-summary.c +++ b/ui-summary.c | |||
@@ -59,7 +59,7 @@ void cgit_print_summary() | |||
59 | if (ctx.cfg.summary_log > 0) { | 59 | if (ctx.cfg.summary_log > 0) { |
60 | html("<tr class='nohover'><td colspan='4'> </td></tr>"); | 60 | html("<tr class='nohover'><td colspan='4'> </td></tr>"); |
61 | cgit_print_log(ctx.qry.head, 0, ctx.cfg.summary_log, NULL, | 61 | cgit_print_log(ctx.qry.head, 0, ctx.cfg.summary_log, NULL, |
62 | NULL, NULL, 0, 0); | 62 | NULL, NULL, 0, 0, 0); |
63 | } | 63 | } |
64 | if (ctx.repo->clone_url) | 64 | if (ctx.repo->clone_url) |
65 | print_urls(expand_macros(ctx.repo->clone_url), NULL); | 65 | print_urls(expand_macros(ctx.repo->clone_url), NULL); |