summaryrefslogtreecommitdiffabout
path: root/ui-tree.c
Unidiff
Diffstat (limited to 'ui-tree.c') (more/less context) (show whitespace changes)
-rw-r--r--ui-tree.c26
1 files changed, 21 insertions, 5 deletions
diff --git a/ui-tree.c b/ui-tree.c
index 553dbaa..c608754 100644
--- a/ui-tree.c
+++ b/ui-tree.c
@@ -17,3 +17,3 @@ int header = 0;
17 17
18static void print_text_buffer(char *buf, unsigned long size) 18static void print_text_buffer(const char *name, char *buf, unsigned long size)
19{ 19{
@@ -24,2 +24,12 @@ static void print_text_buffer(char *buf, unsigned long size)
24 html("<table summary='blob content' class='blob'>\n"); 24 html("<table summary='blob content' class='blob'>\n");
25 if (ctx.repo->source_filter) {
26 html("<tr><td class='lines'><pre><code>");
27 ctx.repo->source_filter->argv[1] = xstrdup(name);
28 cgit_open_filter(ctx.repo->source_filter);
29 write(STDOUT_FILENO, buf, size);
30 cgit_close_filter(ctx.repo->source_filter);
31 html("</code></pre></td></tr></table>\n");
32 return;
33 }
34
25 html("<tr><td class='linenumbers'><pre>"); 35 html("<tr><td class='linenumbers'><pre>");
@@ -67,3 +77,3 @@ static void print_binary_buffer(char *buf, unsigned long size)
67 77
68static void print_object(const unsigned char *sha1, char *path) 78static void print_object(const unsigned char *sha1, char *path, const char *basename)
69{ 79{
@@ -95,3 +105,3 @@ static void print_object(const unsigned char *sha1, char *path)
95 else 105 else
96 print_text_buffer(buf, size); 106 print_text_buffer(basename, buf, size);
97} 107}
@@ -105,2 +115,3 @@ static int ls_item(const unsigned char *sha1, const char *base, int baselen,
105 char *fullpath; 115 char *fullpath;
116 char *class;
106 enum object_type type; 117 enum object_type type;
@@ -137,3 +148,8 @@ static int ls_item(const unsigned char *sha1, const char *base, int baselen,
137 } else { 148 } else {
138 cgit_tree_link(name, NULL, "ls-blob", ctx.qry.head, 149 class = strrchr(name, '.');
150 if (class != NULL) {
151 class = fmt("ls-blob %s", class + 1);
152 } else
153 class = "ls-blob";
154 cgit_tree_link(name, NULL, class, ctx.qry.head,
139 curr_rev, fullpath); 155 curr_rev, fullpath);
@@ -215,3 +231,3 @@ static int walk_tree(const unsigned char *sha1, const char *base, int baselen,
215 } else { 231 } else {
216 print_object(sha1, buffer); 232 print_object(sha1, buffer, pathname);
217 return 0; 233 return 0;