summaryrefslogtreecommitdiffabout
path: root/ui-tree.c
Unidiff
Diffstat (limited to 'ui-tree.c') (more/less context) (ignore whitespace changes)
-rw-r--r--ui-tree.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/ui-tree.c b/ui-tree.c
index 634132f..1cb09f7 100644
--- a/ui-tree.c
+++ b/ui-tree.c
@@ -47,59 +47,59 @@ static void print_object(const unsigned char *sha1, char *path)
47 ++lineno); 47 ++lineno);
48 html_txt(buf + start); 48 html_txt(buf + start);
49 html("</td></tr>\n"); 49 html("</td></tr>\n");
50 start = idx + 1; 50 start = idx + 1;
51 } 51 }
52 idx++; 52 idx++;
53 } 53 }
54 html("</table>\n"); 54 html("</table>\n");
55} 55}
56 56
57 57
58static int ls_item(const unsigned char *sha1, const char *base, int baselen, 58static int ls_item(const unsigned char *sha1, const char *base, int baselen,
59 const char *pathname, unsigned int mode, int stage) 59 const char *pathname, unsigned int mode, int stage)
60{ 60{
61 char *name; 61 char *name;
62 char *fullpath; 62 char *fullpath;
63 enum object_type type; 63 enum object_type type;
64 unsigned long size = 0; 64 unsigned long size = 0;
65 65
66 name = xstrdup(pathname); 66 name = xstrdup(pathname);
67 fullpath = fmt("%s%s%s", cgit_query_path ? cgit_query_path : "", 67 fullpath = fmt("%s%s%s", cgit_query_path ? cgit_query_path : "",
68 cgit_query_path ? "/" : "", name); 68 cgit_query_path ? "/" : "", name);
69 69
70 type = sha1_object_info(sha1, &size); 70 type = sha1_object_info(sha1, &size);
71 if (type == OBJ_BAD && !S_ISDIRLNK(mode)) { 71 if (type == OBJ_BAD && !S_ISGITLINK(mode)) {
72 htmlf("<tr><td colspan='3'>Bad object: %s %s</td></tr>", 72 htmlf("<tr><td colspan='3'>Bad object: %s %s</td></tr>",
73 name, 73 name,
74 sha1_to_hex(sha1)); 74 sha1_to_hex(sha1));
75 return 0; 75 return 0;
76 } 76 }
77 77
78 html("<tr><td class='ls-mode'>"); 78 html("<tr><td class='ls-mode'>");
79 html_filemode(mode); 79 html_filemode(mode);
80 html("</td><td>"); 80 html("</td><td>");
81 if (S_ISDIRLNK(mode)) { 81 if (S_ISGITLINK(mode)) {
82 htmlf("<a class='ls-mod' href='"); 82 htmlf("<a class='ls-mod' href='");
83 html_attr(fmt(cgit_repo->module_link, 83 html_attr(fmt(cgit_repo->module_link,
84 name, 84 name,
85 sha1_to_hex(sha1))); 85 sha1_to_hex(sha1)));
86 html("'>"); 86 html("'>");
87 html_txt(name); 87 html_txt(name);
88 html("</a>"); 88 html("</a>");
89 } else if (S_ISDIR(mode)) { 89 } else if (S_ISDIR(mode)) {
90 cgit_tree_link(name, NULL, "ls-dir", cgit_query_head, 90 cgit_tree_link(name, NULL, "ls-dir", cgit_query_head,
91 curr_rev, fullpath); 91 curr_rev, fullpath);
92 } else { 92 } else {
93 cgit_tree_link(name, NULL, "ls-blob", cgit_query_head, 93 cgit_tree_link(name, NULL, "ls-blob", cgit_query_head,
94 curr_rev, fullpath); 94 curr_rev, fullpath);
95 } 95 }
96 htmlf("</td><td class='ls-size'>%li</td>", size); 96 htmlf("</td><td class='ls-size'>%li</td>", size);
97 97
98 html("<td>"); 98 html("<td>");
99 cgit_log_link("log", NULL, "button", cgit_query_head, curr_rev, 99 cgit_log_link("log", NULL, "button", cgit_query_head, curr_rev,
100 fullpath, 0); 100 fullpath, 0);
101 html("</td></tr>\n"); 101 html("</td></tr>\n");
102 free(name); 102 free(name);
103 return 0; 103 return 0;
104} 104}
105 105