about summary refs log tree commit diff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--ui-stats.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/ui-stats.c b/ui-stats.c
index 9150840..3cc8d70 100644
--- a/ui-stats.c
+++ b/ui-stats.c
@@ -195,7 +195,8 @@ struct string_list collect_stats(struct cgit_context *ctx,
 	struct string_list authors;
 	struct rev_info rev;
 	struct commit *commit;
-	const char *argv[] = {NULL, ctx->qry.head, NULL, NULL};
+	const char *argv[] = {NULL, ctx->qry.head, NULL, NULL, NULL, NULL};
+	int argc = 3;
 	time_t now;
 	long i;
 	struct tm *tm;
@@ -208,13 +209,18 @@ struct string_list collect_stats(struct cgit_context *ctx,
 		period->dec(tm);
 	strftime(tmp, sizeof(tmp), "%Y-%m-%d", tm);
 	argv[2] = xstrdup(fmt("--since=%s", tmp));
+	if (ctx->qry.path) {
+		argv[3] = "--";
+		argv[4] = ctx->qry.path;
+		argc += 2;
+	}
 	init_revisions(&rev, NULL);
 	rev.abbrev = DEFAULT_ABBREV;
 	rev.commit_format = CMIT_FMT_DEFAULT;
 	rev.no_merges = 1;
 	rev.verbose_header = 1;
 	rev.show_root_diff = 0;
-	setup_revisions(3, argv, &rev, NULL);
+	setup_revisions(argc, argv, &rev, NULL);
 	prepare_revision_walk(&rev);
 	memset(&authors, 0, sizeof(authors));
 	while ((commit = get_revision(&rev)) != NULL) {
@@ -351,7 +357,13 @@ void cgit_show_stats(struct cgit_context *ctx)
 	top = ctx->qry.ofs;
 	if (!top)
 		top = 10;
-	htmlf("<h2>Commits per author per %s</h2>", period->name);
+	htmlf("<h2>Commits per author per %s", period->name);
+	if (ctx->qry.path) {
+		html(" (path '");
+		html_txt(ctx->qry.path);
+		html("')");
+	}
+	html("</h2>");
 
 	html("<form method='get' action='.' style='float: right; text-align: right;'>");
 	if (strcmp(ctx->qry.head, ctx->repo->defbranch))
?id=eb171a59b91a0730f095e951ebf783771ec50251&follow=1'>Fix shell script style in ~/.local/binJune McEnroe 2019-07-27Shell script style passJune McEnroe 2019-07-27Add c11.pdfJune McEnroe 2019-07-27Move pdf script to MakefileJune McEnroe 2019-07-27Update macOS neovim to 0.3.8June McEnroe Which somehow still doesn't include my man fix. 2019-07-27Rewrite port makefiles consistentlyJune McEnroe 2019-07-27Rewrite Makefile once more with more organizationJune McEnroe 2019-07-27Reference png.h in bin.7June McEnroe 2019-07-27Revert "Use scheme to style HTMLs"June McEnroe This reverts commit 4b7d5161a30645b0a23691687ef1aafdda62d3bb. I don't know why but I don't like it. 2019-07-27Remove scheme text linkJune McEnroe No standard base64 encoder so no way to maintain it. 2019-07-26Update Dark.terminalJune McEnroe Why are the blobs so much bigger now? 2019-07-26Lighten dark whiteJune McEnroe 2019-07-25Add png.3 man pageJune McEnroe 2019-07-25Use scheme to style HTMLsJune McEnroe 2019-07-25Don't match comments in strings in makeJune McEnroe 2019-07-25Generate index.html with links from bin.7June McEnroe 2019-07-24Warn when date has changedJune McEnroe 2019-07-24Add whenJune McEnroe When? Now. 2019-07-24Remove histedit from bitJune McEnroe