summaryrefslogtreecommitdiffabout
path: root/ui-tree.c
Unidiff
Diffstat (limited to 'ui-tree.c') (more/less context) (ignore whitespace changes)
-rw-r--r--ui-tree.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/ui-tree.c b/ui-tree.c
index caf6a9e..c608754 100644
--- a/ui-tree.c
+++ b/ui-tree.c
@@ -110,12 +110,13 @@ static void print_object(const unsigned char *sha1, char *path, const char *base
110static int ls_item(const unsigned char *sha1, const char *base, int baselen, 110static int ls_item(const unsigned char *sha1, const char *base, int baselen,
111 const char *pathname, unsigned int mode, int stage, 111 const char *pathname, unsigned int mode, int stage,
112 void *cbdata) 112 void *cbdata)
113{ 113{
114 char *name; 114 char *name;
115 char *fullpath; 115 char *fullpath;
116 char *class;
116 enum object_type type; 117 enum object_type type;
117 unsigned long size = 0; 118 unsigned long size = 0;
118 119
119 name = xstrdup(pathname); 120 name = xstrdup(pathname);
120 fullpath = fmt("%s%s%s", ctx.qry.path ? ctx.qry.path : "", 121 fullpath = fmt("%s%s%s", ctx.qry.path ? ctx.qry.path : "",
121 ctx.qry.path ? "/" : "", name); 122 ctx.qry.path ? "/" : "", name);
@@ -142,13 +143,18 @@ static int ls_item(const unsigned char *sha1, const char *base, int baselen,
142 html_txt(name); 143 html_txt(name);
143 html("</a>"); 144 html("</a>");
144 } else if (S_ISDIR(mode)) { 145 } else if (S_ISDIR(mode)) {
145 cgit_tree_link(name, NULL, "ls-dir", ctx.qry.head, 146 cgit_tree_link(name, NULL, "ls-dir", ctx.qry.head,
146 curr_rev, fullpath); 147 curr_rev, fullpath);
147 } else { 148 } else {
148 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,
149 curr_rev, fullpath); 155 curr_rev, fullpath);
150 } 156 }
151 htmlf("</td><td class='ls-size'>%li</td>", size); 157 htmlf("</td><td class='ls-size'>%li</td>", size);
152 158
153 html("<td>"); 159 html("<td>");
154 cgit_log_link("log", NULL, "button", ctx.qry.head, curr_rev, 160 cgit_log_link("log", NULL, "button", ctx.qry.head, curr_rev,