From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jason at zx2c4.com (Jason A. Donenfeld) Date: Sat, 14 Oct 2017 16:17:50 +0200 Subject: [PATCH 4/4] ui-blame: put source lines through filter In-Reply-To: <20171014141750.14013-1-Jason@zx2c4.com> References: <20171014141750.14013-1-Jason@zx2c4.com> Message-ID: <20171014141750.14013-5-Jason@zx2c4.com> We toggle the filter on and off so that the control table can avoid going through the filter. Signed-off-by: Jason A. Donenfeld --- ui-blame.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/ui-blame.c b/ui-blame.c index 62cf431..71aec65 100644 --- a/ui-blame.c +++ b/ui-blame.c @@ -70,7 +70,12 @@ static void emit_blame_entry(struct blame_scoreboard *sb, cpend = blame_nth_line(sb, ent->lno + ent->num_lines); html("
");
-	html_ntxt(cp, cpend - cp);
+	if (ctx.repo->source_filter) {
+		cgit_enable_filter(ctx.repo->source_filter, true);
+		html_raw(cp, cpend - cp);
+		cgit_enable_filter(ctx.repo->source_filter, false);
+	} else
+		html_ntxt(cp, cpend - cp);
 	html("
\n"); } @@ -90,6 +95,7 @@ static void print_object(const unsigned char *sha1, const char *path, struct blame_scoreboard sb; struct blame_origin *o; struct blame_entry *ent = NULL; + char *filter_arg; type = sha1_object_info(sha1, &size); if (type == OBJ_BAD) { @@ -131,6 +137,11 @@ static void print_object(const unsigned char *sha1, const char *path, return; } + if (ctx.repo->source_filter) { + filter_arg = xstrdup(path); + cgit_open_filter(ctx.repo->source_filter, filter_arg); + cgit_enable_filter(ctx.repo->source_filter, false); + } html(""); for (ent = sb.ent; ent; ) { struct blame_entry *e = ent->next; @@ -139,6 +150,8 @@ static void print_object(const unsigned char *sha1, const char *path, ent = e; } html("
\n"); + if (ctx.repo->source_filter) + cgit_close_filter(ctx.repo->source_filter); free((void *)sb.final_buf); cgit_print_layout_end(); -- 2.14.2