From 792f813d342013124ce40142fef4afee3ff00df3 Mon Sep 17 00:00:00 2001 From: Tobias Bieniek Date: Sat, 13 Oct 2012 16:10:30 +0200 Subject: ui-log: Add "commit-sort" option for controlling commit ordering This makes it possible to use strict commit date ordering or strict topological ordering by passing the corresponding flags to "git log". Signed-off-by: Jason A. Donenfeld --- ui-log.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'ui-log.c') diff --git a/ui-log.c b/ui-log.c index 6b12ca2..2f41602 100644 --- a/ui-log.c +++ b/ui-log.c @@ -278,7 +278,7 @@ static char *next_token(char **src) } void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *pattern, - char *path, int pager, int commit_graph) + char *path, int pager, int commit_graph, int commit_sort) { struct rev_info rev; struct commit *commit; @@ -327,6 +327,14 @@ void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *pattern COLUMN_COLORS_HTML_MAX); } + if (commit_sort == 1) { + static const char *date_order_arg = "--date-order"; + vector_push(&vec, &date_order_arg, 0); + } else if (commit_sort == 2) { + static const char *topo_order_arg = "--topo-order"; + vector_push(&vec, &topo_order_arg, 0); + } + if (path) { arg = "--"; vector_push(&vec, &arg, 0); -- cgit v1.2.1