From mboxrd@z Thu Jan 1 00:00:00 1970 From: Tobias.Bieniek at gmx.de (Tobias Bieniek) Date: Mon, 2 Jul 2012 17:38:57 +0200 Subject: [PATCH 2/3] Added "date-order" and "topo-order" flags In-Reply-To: <1341243538-15160-1-git-send-email-Tobias.Bieniek@gmx.de> References: <1341243538-15160-1-git-send-email-Tobias.Bieniek@gmx.de> Message-ID: <1341243538-15160-2-git-send-email-Tobias.Bieniek@gmx.de> This makes it possible to use strict commit date ordering even when the commit graph flag is activated. --- cgit.c | 8 ++++++++ cgit.h | 4 ++++ cgitrc.5.txt | 22 ++++++++++++++++++++++ cmd.c | 3 ++- shared.c | 2 ++ ui-log.c | 13 ++++++++++++- ui-log.h | 2 +- ui-summary.c | 2 +- 8 files changed, 52 insertions(+), 4 deletions(-) diff --git a/cgit.c b/cgit.c index 4ec00f6..f8c9a53 100644 --- a/cgit.c +++ b/cgit.c @@ -84,6 +84,10 @@ void repo_config(struct cgit_repo *repo, const char *name, const char *value) repo->enable_remote_branches = atoi(value); else if (!strcmp(name, "enable-subject-links")) repo->enable_subject_links = atoi(value); + else if (!strcmp(name, "date-order")) + repo->date_order = atoi(value); + else if (!strcmp(name, "topo-order")) + repo->topo_order = atoi(value); else if (!strcmp(name, "max-stats")) repo->max_stats = cgit_find_stats_period(value, NULL); else if (!strcmp(name, "module-link")) @@ -257,6 +261,10 @@ void config_cb(const char *name, const char *value) ctx.cfg.clone_url = xstrdup(value); else if (!strcmp(name, "local-time")) ctx.cfg.local_time = atoi(value); + else if (!strcmp(name, "date-order")) + ctx.cfg.date_order = atoi(value); + else if (!strcmp(name, "topo-order")) + ctx.cfg.topo_order = atoi(value); else if (!prefixcmp(name, "mimetype.")) add_mimetype(name + 9, value); else if (!strcmp(name, "include")) diff --git a/cgit.h b/cgit.h index 86afad1..a597b42 100644 --- a/cgit.h +++ b/cgit.h @@ -84,6 +84,8 @@ struct cgit_repo { int enable_remote_branches; int enable_subject_links; int max_stats; + int date_order; + int topo_order; time_t mtime; struct cgit_filter *about_filter; struct cgit_filter *commit_filter; @@ -229,6 +231,8 @@ struct cgit_config { int summary_log; int summary_tags; int ssdiff; + int date_order; + int topo_order; struct string_list mimetypes; struct cgit_filter *about_filter; struct cgit_filter *commit_filter; diff --git a/cgitrc.5.txt b/cgitrc.5.txt index 3e2d87f..70db7d5 100644 --- a/cgitrc.5.txt +++ b/cgitrc.5.txt @@ -92,6 +92,12 @@ css:: Url which specifies the css document to include in all cgit pages. Default value: "/cgit.css". +date-order:: + Flag which, when set to "1", will make add the "date-order" parameter + to all "git log" calls. This enables strict commit date ordering, + also for the commit graph, that can be enabled with the + "enable-commit-graph" flag. Default value: "0". + embedded:: Flag which, when set to "1", will make cgit generate a html fragment suitable for embedding in other html pages. Default value: none. See @@ -368,6 +374,11 @@ strict-export:: repositories to match those exported by git-daemon. This option MUST come before 'scan-path'. +topo-order:: + Flag which, when set to "1", will make add the "topo-order" parameter + to all "git log" calls. This order the commit in topological order. + Default value: "0". + virtual-root:: Url which, if specified, will be used as root for all cgit links. It will also cause cgit to generate 'virtual urls', i.e. urls like @@ -390,6 +401,12 @@ repo.commit-filter:: Override the default commit-filter. Default value: none. See also: "enable-filter-overrides". See also: "FILTER API". +repo.date-order:: + Flag which, when set to "1", will make add the "date-order" parameter + to all "git log" calls. This enables strict commit date ordering, + also for the commit graph, that can be enabled with the + "enable-commit-graph" flag. Default value: "0". + repo.defbranch:: The name of the default branch for this repository. If no such branch exists in the repository, the first branch name (when sorted) is used @@ -474,6 +491,11 @@ repo.source-filter:: Override the default source-filter. Default value: none. See also: "enable-filter-overrides". See also: "FILTER API". +repo.topo-order:: + Flag which, when set to "1", will make add the "topo-order" parameter + to all "git log" calls. This order the commit in topological order. + Default value: "0". + repo.url:: The relative url used to access the repository. This must be the first setting specified for each repo. Default value: none. diff --git a/cmd.c b/cmd.c index 5a3d157..04d25ed 100644 --- a/cmd.c +++ b/cmd.c @@ -68,7 +68,8 @@ static void log_fn(struct cgit_context *ctx) { cgit_print_log(ctx->qry.sha1, ctx->qry.ofs, ctx->cfg.max_commit_count, ctx->qry.grep, ctx->qry.search, ctx->qry.path, 1, - ctx->repo->enable_commit_graph); + ctx->repo->enable_commit_graph, + ctx->repo->date_order, ctx->repo->topo_order); } static void ls_cache_fn(struct cgit_context *ctx) diff --git a/shared.c b/shared.c index 0a0e22e..4e8a9e7 100644 --- a/shared.c +++ b/shared.c @@ -62,6 +62,8 @@ struct cgit_repo *cgit_add_repo(const char *url) ret->enable_remote_branches = ctx.cfg.enable_remote_branches; ret->enable_subject_links = ctx.cfg.enable_subject_links; ret->max_stats = ctx.cfg.max_stats; + ret->date_order = ctx.cfg.date_order; + ret->topo_order = ctx.cfg.topo_order; ret->module_link = ctx.cfg.module_link; ret->readme = ctx.cfg.readme; ret->mtime = -1; diff --git a/ui-log.c b/ui-log.c index 6b12ca2..4c1a10c 100644 --- a/ui-log.c +++ b/ui-log.c @@ -278,7 +278,8 @@ 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 date_order, int topo_order) { struct rev_info rev; struct commit *commit; @@ -327,6 +328,16 @@ void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *pattern COLUMN_COLORS_HTML_MAX); } + if (date_order) { + static const char *date_order_arg = "--date-order"; + vector_push(&vec, &date_order_arg, 0); + } + + if (topo_order) { + static const char *topo_order_arg = "--topo-order"; + vector_push(&vec, &topo_order_arg, 0); + } + if (path) { arg = "--"; vector_push(&vec, &arg, 0); diff --git a/ui-log.h b/ui-log.h index d0cb779..68fff08 100644 --- a/ui-log.h +++ b/ui-log.h @@ -3,7 +3,7 @@ extern void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *pattern, char *path, int pager, - int commit_graph); + int commit_graph, int date_order, int topo_order); extern void show_commit_decorations(struct commit *commit); #endif /* UI_LOG_H */ diff --git a/ui-summary.c b/ui-summary.c index 227ed27..f08e59e 100644 --- a/ui-summary.c +++ b/ui-summary.c @@ -59,7 +59,7 @@ void cgit_print_summary() if (ctx.cfg.summary_log > 0) { html(" "); cgit_print_log(ctx.qry.head, 0, ctx.cfg.summary_log, NULL, - NULL, NULL, 0, 0); + NULL, NULL, 0, 0, 0, 0); } if (ctx.repo->clone_url) print_urls(expand_macros(ctx.repo->clone_url), NULL); -- 1.7.10