X-Git-Url: https://gitweb.ps.run/ps-cgit/blobdiff_plain/b4c3562f57c924866314d0f80f46dddecd4ce61a..03389d6e67bfda5cb3ff1504db815f09715ec6f4:/ui-tree.c
diff --git a/ui-tree.c b/ui-tree.c
index 61fcf5a..7bf2ad2 100644
--- a/ui-tree.c
+++ b/ui-tree.c
@@ -15,13 +15,14 @@ char *curr_rev;
char *match_path;
int header = 0;
-static void print_text_buffer(char *buf, unsigned long size)
+static void print_text_buffer(const char *name, char *buf, unsigned long size)
{
unsigned long lineno, idx;
const char *numberfmt =
"%1$d\n";
html("
\n");
+
html("");
idx = 0;
lineno = 0;
@@ -35,6 +36,17 @@ static void print_text_buffer(char *buf, unsigned long size)
}
}
html(" | \n");
+
+ if (ctx.repo->source_filter) {
+ html("");
+ ctx.repo->source_filter->argv[1] = xstrdup(name);
+ cgit_open_filter(ctx.repo->source_filter);
+ write(STDOUT_FILENO, buf, size);
+ cgit_close_filter(ctx.repo->source_filter);
+ html("
|
\n");
+ return;
+ }
+
html("");
html_txt(buf);
html("
| \n");
@@ -65,7 +77,7 @@ static void print_binary_buffer(char *buf, unsigned long size)
html("\n");
}
-static void print_object(const unsigned char *sha1, char *path)
+static void print_object(const unsigned char *sha1, char *path, const char *basename)
{
enum object_type type;
char *buf;
@@ -93,7 +105,7 @@ static void print_object(const unsigned char *sha1, char *path)
if (buffer_is_binary(buf, size))
print_binary_buffer(buf, size);
else
- print_text_buffer(buf, size);
+ print_text_buffer(basename, buf, size);
}
@@ -219,7 +231,7 @@ static int walk_tree(const unsigned char *sha1, const char *base, int baselen,
ls_head();
return READ_TREE_RECURSIVE;
} else {
- print_object(sha1, buffer);
+ print_object(sha1, buffer, pathname);
return 0;
}
}