This makes it possible to use strict commit date ordering or strict topological ordering by passing the corresponding flags to "git log".
Unified · Split
| @@ -84,7 +84,12 @@ void repo_config(struct cgit_repo *repo, const char *name, const char *value) · 83 unmodified lines | ||
| 84 | 84 | repo->enable_remote_branches = atoi(value); |
| 85 | 85 | else if (!strcmp(name, "enable-subject-links")) |
| 86 | 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 | 93 | repo->max_stats = cgit_find_stats_period(value, NULL); |
| 89 | 94 | else if (!strcmp(name, "module-link")) |
| 90 | 95 | repo->module_link= xstrdup(value); |
| @@ -261,7 +266,12 @@ void config_cb(const char *name, const char *value) · 170 unmodified lines | ||
| 261 | 266 | ctx.cfg.clone_url = xstrdup(value); |
| 262 | 267 | else if (!strcmp(name, "local-time")) |
| 263 | 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 | 275 | add_mimetype(name + 9, value); |
| 266 | 276 | else if (!strcmp(name, "include")) |
| 267 | 277 | parse_configfile(expand_macros(value), config_cb); |
| @@ -84,6 +84,7 @@ struct cgit_repo { · 83 unmodified lines | ||
| 84 | 84 | int enable_remote_branches; |
| 85 | 85 | int enable_subject_links; |
| 86 | 86 | int max_stats; |
| 87 | + int commit_sort; | |
| 87 | 88 | time_t mtime; |
| 88 | 89 | struct cgit_filter *about_filter; |
| 89 | 90 | struct cgit_filter *commit_filter; |
| @@ -231,6 +232,7 @@ struct cgit_config { · 141 unmodified lines | ||
| 231 | 232 | int summary_log; |
| 232 | 233 | int summary_tags; |
| 233 | 234 | int ssdiff; |
| 235 | + int commit_sort; | |
| 234 | 236 | struct string_list mimetypes; |
| 235 | 237 | struct cgit_filter *about_filter; |
| 236 | 238 | struct cgit_filter *commit_filter; |
| @@ -192,6 +192,12 @@ local-time:: · 191 unmodified lines | ||
| 192 | 192 | Flag which, if set to "1", makes cgit print commit and tag times in the |
| 193 | 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 | 201 | logo:: |
| 196 | 202 | Url which specifies the source of an image which will be used as a logo |
| 197 | 203 | on all cgit pages. Default value: "/cgit.png". |
| @@ -435,6 +441,12 @@ repo.enable-subject-links:: · 237 unmodified lines | ||
| 435 | 441 | A flag which can be used to override the global setting |
| 436 | 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 | 450 | repo.logo:: |
| 439 | 451 | Url which specifies the source of an image which will be used as a logo |
| 440 | 452 | on this repo's pages. Default value: global logo. |
| @@ -68,7 +68,8 @@ static void log_fn(struct cgit_context *ctx) · 67 unmodified lines | ||
| 68 | 68 | { |
| 69 | 69 | cgit_print_log(ctx->qry.sha1, ctx->qry.ofs, ctx->cfg.max_commit_count, |
| 70 | 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 | 75 | static void ls_cache_fn(struct cgit_context *ctx) |
| @@ -63,6 +63,7 @@ struct cgit_repo *cgit_add_repo(const char *url) · 62 unmodified lines | ||
| 63 | 63 | ret->enable_remote_branches = ctx.cfg.enable_remote_branches; |
| 64 | 64 | ret->enable_subject_links = ctx.cfg.enable_subject_links; |
| 65 | 65 | ret->max_stats = ctx.cfg.max_stats; |
| 66 | + ret->commit_sort = ctx.cfg.commit_sort; | |
| 66 | 67 | ret->module_link = ctx.cfg.module_link; |
| 67 | 68 | ret->readme = ctx.cfg.readme; |
| 68 | 69 | ret->mtime = -1; |
| @@ -278,7 +278,7 @@ static char *next_token(char **src) · 277 unmodified lines | ||
| 278 | 278 | } |
| 279 | 279 | |
| 280 | 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 | 283 | struct rev_info rev; |
| 284 | 284 | struct commit *commit; |
| @@ -327,6 +327,14 @@ void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *pattern · 42 unmodified lines | ||
| 327 | 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 | 338 | if (path) { |
| 331 | 339 | arg = "--"; |
| 332 | 340 | vector_push(&vec, &arg, 0); |
| @@ -3,7 +3,7 @@ · 2 unmodified lines | ||
| 3 | 3 | |
| 4 | 4 | extern void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, |
| 5 | 5 | char *pattern, char *path, int pager, |
| 6 | − int commit_graph); | |
| 6 | + int commit_graph, int commit_sort); | |
| 7 | 7 | extern void show_commit_decorations(struct commit *commit); |
| 8 | 8 | |
| 9 | 9 | #endif /* UI_LOG_H */ |
| @@ -59,7 +59,7 @@ void cgit_print_summary() · 58 unmodified lines | ||
| 59 | 59 | if (ctx.cfg.summary_log > 0) { |
| 60 | 60 | html("<tr class='nohover'><td colspan='4'> </td></tr>"); |
| 61 | 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 | 64 | if (ctx.repo->clone_url) |
| 65 | 65 | print_urls(expand_macros(ctx.repo->clone_url), NULL); |