|
diff --git a/ui-tree.c b/ui-tree.c index caf6a9e..c608754 100644 --- a/ ui-tree.c+++ b/ ui-tree.c |
|
@@ -104,24 +104,25 @@ static void print_object(const unsigned char *sha1, char *path, const char *base |
104 | print_binary_buffer(buf, size); |
104 | print_binary_buffer(buf, size); |
105 | else |
105 | else |
106 | print_text_buffer(basename, buf, size); |
106 | print_text_buffer(basename, buf, size); |
107 | } |
107 | } |
108 | |
108 | |
109 | |
109 | |
110 | static int ls_item(const unsigned char *sha1, const char *base, int baselen, |
110 | static 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); |
122 | |
123 | |
123 | if (!S_ISGITLINK(mode)) { |
124 | if (!S_ISGITLINK(mode)) { |
124 | type = sha1_object_info(sha1, &size); |
125 | type = sha1_object_info(sha1, &size); |
125 | if (type == OBJ_BAD) { |
126 | if (type == OBJ_BAD) { |
126 | htmlf("<tr><td colspan='3'>Bad object: %s %s</td></tr>", |
127 | htmlf("<tr><td colspan='3'>Bad object: %s %s</td></tr>", |
127 | name, |
128 | name, |
@@ -136,25 +137,30 @@ static int ls_item(const unsigned char *sha1, const char *base, int baselen, |
136 | if (S_ISGITLINK(mode)) { |
137 | if (S_ISGITLINK(mode)) { |
137 | htmlf("<a class='ls-mod' href='"); |
138 | htmlf("<a class='ls-mod' href='"); |
138 | html_attr(fmt(ctx.repo->module_link, |
139 | html_attr(fmt(ctx.repo->module_link, |
139 | name, |
140 | name, |
140 | sha1_to_hex(sha1))); |
141 | sha1_to_hex(sha1))); |
141 | html("'>"); |
142 | html("'>"); |
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, |
155 | fullpath, 0, NULL, NULL, ctx.qry.showmsg); |
161 | fullpath, 0, NULL, NULL, ctx.qry.showmsg); |
156 | if (ctx.repo->max_stats) |
162 | if (ctx.repo->max_stats) |
157 | cgit_stats_link("stats", NULL, "button", ctx.qry.head, |
163 | cgit_stats_link("stats", NULL, "button", ctx.qry.head, |
158 | fullpath); |
164 | fullpath); |
159 | html("</td></tr>\n"); |
165 | html("</td></tr>\n"); |
160 | free(name); |
166 | free(name); |
|