Thread (11 messages) flat view 11 messages, 2 authors, 2016-06-15

[CGit] [PATCH 5/6] commit_filter: also communicate the repo name to the filter

From: Ferry Huberts <hidden>
Date: 2016-06-15 22:50:35
Subsystem: the rest · Maintainer: Linus Torvalds

From: Ferry Huberts <redacted>

Signed-off-by: Ferry Huberts <redacted>
---
 cgit.c                  |    5 ++++-
 filters/commit-links.sh |    2 ++
 ui-commit.c             |    5 ++++-
 3 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/cgit.c b/cgit.c
index 65c892c..9e8c4c4 100644
--- a/cgit.c
+++ b/cgit.c
@@ -41,10 +41,13 @@ struct cgit_filter *new_filter(const char *cmd, filter_type filtertype)
 
 	switch (filtertype) {
 		case about:
-		case commit:
 			extra_args = 0;
 			break;
 
+		case commit:
+			extra_args = 1;
+			break;
+
 		case source:
 			extra_args = 2;
 			break;
diff --git a/filters/commit-links.sh b/filters/commit-links.sh
index 110c609..d098cd5 100755
--- a/filters/commit-links.sh
+++ b/filters/commit-links.sh
@@ -3,6 +3,8 @@
 #
 # To use this script, refer to this file with either the commit-filter or the
 # repo.commit-filter options in cgitrc.
+#
+# 1st argument is the repo name
 
 # This expression generates links to commits referenced by their SHA1.
 regex=$regex'
diff --git a/ui-commit.c b/ui-commit.c
index 2b4f677..b0607d0 100644
--- a/ui-commit.c
+++ b/ui-commit.c
@@ -109,8 +109,11 @@ void cgit_print_commit(char *hex, const char *prefix)
 	}
 	html("</table>\n");
 	html("<div class='commit-subject'>");
-	if (ctx.repo->commit_filter)
+	if (ctx.repo->commit_filter) {
+		if (!ctx.repo->commit_filter->argv[1])
+			ctx.repo->commit_filter->argv[1] = xstrdup(ctx.repo->name);
 		cgit_open_filter(ctx.repo->commit_filter);
+	}
 	html_txt(info->subject);
 	if (ctx.repo->commit_filter)
 		cgit_close_filter(ctx.repo->commit_filter);
-- 
1.7.4
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help