summaryrefslogtreecommitdiffabout
path: root/ui-tree.c
Unidiff
Diffstat (limited to 'ui-tree.c') (more/less context) (show whitespace changes)
-rw-r--r--ui-tree.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/ui-tree.c b/ui-tree.c
index d503bee..e16b638 100644
--- a/ui-tree.c
+++ b/ui-tree.c
@@ -63,72 +63,68 @@ static int ls_item(const unsigned char *sha1, const char *base, int baselen,
63 name = xstrdup(pathname); 63 name = xstrdup(pathname);
64 fullpath = fmt("%s%s%s", cgit_query_path ? cgit_query_path : "", 64 fullpath = fmt("%s%s%s", cgit_query_path ? cgit_query_path : "",
65 cgit_query_path ? "/" : "", name); 65 cgit_query_path ? "/" : "", name);
66 66
67 type = sha1_object_info(sha1, &size); 67 type = sha1_object_info(sha1, &size);
68 if (type == OBJ_BAD && !S_ISDIRLNK(mode)) { 68 if (type == OBJ_BAD && !S_ISDIRLNK(mode)) {
69 htmlf("<tr><td colspan='3'>Bad object: %s %s</td></tr>", 69 htmlf("<tr><td colspan='3'>Bad object: %s %s</td></tr>",
70 name, 70 name,
71 sha1_to_hex(sha1)); 71 sha1_to_hex(sha1));
72 return 0; 72 return 0;
73 } 73 }
74 74
75 html("<tr><td class='ls-mode'>"); 75 html("<tr><td class='ls-mode'>");
76 html_filemode(mode); 76 html_filemode(mode);
77 html("</td><td>"); 77 html("</td><td>");
78 if (S_ISDIRLNK(mode)) { 78 if (S_ISDIRLNK(mode)) {
79 htmlf("<a class='ls-mod' href='"); 79 htmlf("<a class='ls-mod' href='");
80 html_attr(fmt(cgit_repo->module_link, 80 html_attr(fmt(cgit_repo->module_link,
81 name, 81 name,
82 sha1_to_hex(sha1))); 82 sha1_to_hex(sha1)));
83 html("'>"); 83 html("'>");
84 html_txt(name); 84 html_txt(name);
85 html("</a>"); 85 html("</a>");
86 } else if (S_ISDIR(mode)) { 86 } else if (S_ISDIR(mode)) {
87 cgit_tree_link(name, NULL, "ls-dir", cgit_query_head, 87 cgit_tree_link(name, NULL, "ls-dir", cgit_query_head,
88 curr_rev, fullpath); 88 curr_rev, fullpath);
89 } else { 89 } else {
90 cgit_tree_link(name, NULL, "ls-blob", cgit_query_head, 90 cgit_tree_link(name, NULL, "ls-blob", cgit_query_head,
91 curr_rev, fullpath); 91 curr_rev, fullpath);
92 } 92 }
93 htmlf("</td><td class='ls-size'>%li</td>", size); 93 htmlf("</td><td class='ls-size'>%li</td>", size);
94 94
95 html("<td><a href='"); 95 html("<td>");
96 qry = fmt("h=%s&amp;path=%s%s%s", curr_rev, 96 cgit_log_link("L", "Log", "button", cgit_query_head, curr_rev,
97 cgit_query_path ? cgit_query_path : "", 97 fullpath);
98 cgit_query_path ? "/" : "", pathname); 98 html("</td></tr>\n");
99 url = cgit_pageurl(cgit_query_repo, "log", qry);
100 html_attr(url);
101 html("' title='Log' class='button'>L</a></td>");
102 html("</tr>\n");
103 free(name); 99 free(name);
104 return 0; 100 return 0;
105} 101}
106 102
107static void ls_head() 103static void ls_head()
108{ 104{
109 html("<table class='list'>\n"); 105 html("<table class='list'>\n");
110 html("<tr class='nohover'>"); 106 html("<tr class='nohover'>");
111 html("<th class='left'>Mode</th>"); 107 html("<th class='left'>Mode</th>");
112 html("<th class='left'>Name</th>"); 108 html("<th class='left'>Name</th>");
113 html("<th class='right'>Size</th>"); 109 html("<th class='right'>Size</th>");
114 html("<th/>"); 110 html("<th/>");
115 html("</tr>\n"); 111 html("</tr>\n");
116 header = 1; 112 header = 1;
117} 113}
118 114
119static void ls_tail() 115static void ls_tail()
120{ 116{
121 if (!header) 117 if (!header)
122 return; 118 return;
123 html("</table>\n"); 119 html("</table>\n");
124 header = 0; 120 header = 0;
125} 121}
126 122
127static void ls_tree(const unsigned char *sha1, char *path) 123static void ls_tree(const unsigned char *sha1, char *path)
128{ 124{
129 struct tree *tree; 125 struct tree *tree;
130 126
131 tree = parse_tree_indirect(sha1); 127 tree = parse_tree_indirect(sha1);
132 if (!tree) { 128 if (!tree) {
133 cgit_print_error(fmt("Not a tree object: %s", 129 cgit_print_error(fmt("Not a tree object: %s",
134 sha1_to_hex(sha1))); 130 sha1_to_hex(sha1)));