diff options
Diffstat (limited to 'ui-tree.c')
| -rw-r--r-- | ui-tree.c | 19 |
1 files changed, 10 insertions, 9 deletions
| @@ -15,11 +15,11 @@ static int print_entry(const unsigned char *sha1, const char *base, | |||
| 15 | { | 15 | { |
| 16 | char *name; | 16 | char *name; |
| 17 | enum object_type type; | 17 | enum object_type type; |
| 18 | unsigned long size; | 18 | unsigned long size = 0; |
| 19 | 19 | ||
| 20 | name = xstrdup(pathname); | 20 | name = xstrdup(pathname); |
| 21 | type = sha1_object_info(sha1, &size); | 21 | type = sha1_object_info(sha1, &size); |
| 22 | if (type == OBJ_BAD) { | 22 | if (type == OBJ_BAD && !S_ISDIRLNK(mode)) { |
| 23 | htmlf("<tr><td colspan='3'>Bad object: %s %s</td></tr>", | 23 | htmlf("<tr><td colspan='3'>Bad object: %s %s</td></tr>", |
| 24 | name, | 24 | name, |
| 25 | sha1_to_hex(sha1)); | 25 | sha1_to_hex(sha1)); |
| @@ -27,26 +27,27 @@ static int print_entry(const unsigned char *sha1, const char *base, | |||
| 27 | } | 27 | } |
| 28 | html("<tr><td class='filemode'>"); | 28 | html("<tr><td class='filemode'>"); |
| 29 | html_filemode(mode); | 29 | html_filemode(mode); |
| 30 | html("</td><td>"); | 30 | html("</td><td "); |
| 31 | if (S_ISDIRLNK(mode)) { | 31 | if (S_ISDIRLNK(mode)) { |
| 32 | htmlf("<div class='ls-dirlnk'>%s => submodule</div>", name); | 32 | htmlf("class='ls-mod'><a href='"); |
| 33 | html_attr(fmt(cgit_repo->module_link, | ||
| 34 | name, | ||
| 35 | sha1_to_hex(sha1))); | ||
| 33 | } else if (S_ISDIR(mode)) { | 36 | } else if (S_ISDIR(mode)) { |
| 34 | html("<div class='ls-dir'><a href='"); | 37 | html("class='ls-dir'><a href='"); |
| 35 | html_attr(cgit_pageurl(cgit_query_repo, "tree", | 38 | html_attr(cgit_pageurl(cgit_query_repo, "tree", |
| 36 | fmt("id=%s&path=%s%s/", | 39 | fmt("id=%s&path=%s%s/", |
| 37 | sha1_to_hex(sha1), | 40 | sha1_to_hex(sha1), |
| 38 | cgit_query_path ? cgit_query_path : "", | 41 | cgit_query_path ? cgit_query_path : "", |
| 39 | pathname))); | 42 | pathname))); |
| 40 | htmlf("'>%s</a></div>", name); | ||
| 41 | } else { | 43 | } else { |
| 42 | html("<div class='ls-blob'><a href='"); | 44 | html("class='ls-blob'><a href='"); |
| 43 | html_attr(cgit_pageurl(cgit_query_repo, "view", | 45 | html_attr(cgit_pageurl(cgit_query_repo, "view", |
| 44 | fmt("id=%s&path=%s%s", sha1_to_hex(sha1), | 46 | fmt("id=%s&path=%s%s", sha1_to_hex(sha1), |
| 45 | cgit_query_path ? cgit_query_path : "", | 47 | cgit_query_path ? cgit_query_path : "", |
| 46 | pathname))); | 48 | pathname))); |
| 47 | htmlf("'>%s</a></div>", name); | ||
| 48 | } | 49 | } |
| 49 | html("</div></td>"); | 50 | htmlf("'>%s</a></div></td>", name); |
| 50 | htmlf("<td class='filesize'>%li</td>", size); | 51 | htmlf("<td class='filesize'>%li</td>", size); |
| 51 | html("</tr>\n"); | 52 | html("</tr>\n"); |
| 52 | free(name); | 53 | free(name); |
