summaryrefslogtreecommitdiffabout
path: root/ui-tree.c
Unidiff
Diffstat (limited to 'ui-tree.c') (more/less context) (ignore whitespace changes)
-rw-r--r--ui-tree.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/ui-tree.c b/ui-tree.c
index c138877..7cae85a 100644
--- a/ui-tree.c
+++ b/ui-tree.c
@@ -33,9 +33,9 @@ static void print_object(const unsigned char *sha1, char *path)
33 return; 33 return;
34 } 34 }
35 35
36 html(" blob: <a href='"); 36 html(" blob: <a href='");
37 html_attr(cgit_pageurl(cgit_query_repo, "blob", fmt("id=%s", sha1_to_hex(sha1)))); 37 html_attr(cgit_pageurl(ctx.qry.repo, "blob", fmt("id=%s", sha1_to_hex(sha1))));
38 htmlf("'>%s</a>",sha1_to_hex(sha1)); 38 htmlf("'>%s</a>",sha1_to_hex(sha1));
39 39
40 html("<table summary='blob content' class='blob'>\n"); 40 html("<table summary='blob content' class='blob'>\n");
41 idx = 0; 41 idx = 0;
@@ -66,10 +66,10 @@ static int ls_item(const unsigned char *sha1, const char *base, int baselen,
66 enum object_type type; 66 enum object_type type;
67 unsigned long size = 0; 67 unsigned long size = 0;
68 68
69 name = xstrdup(pathname); 69 name = xstrdup(pathname);
70 fullpath = fmt("%s%s%s", cgit_query_path ? cgit_query_path : "", 70 fullpath = fmt("%s%s%s", ctx.qry.path ? ctx.qry.path : "",
71 cgit_query_path ? "/" : "", name); 71 ctx.qry.path ? "/" : "", name);
72 72
73 type = sha1_object_info(sha1, &size); 73 type = sha1_object_info(sha1, &size);
74 if (type == OBJ_BAD && !S_ISGITLINK(mode)) { 74 if (type == OBJ_BAD && !S_ISGITLINK(mode)) {
75 htmlf("<tr><td colspan='3'>Bad object: %s %s</td></tr>", 75 htmlf("<tr><td colspan='3'>Bad object: %s %s</td></tr>",
@@ -89,18 +89,18 @@ static int ls_item(const unsigned char *sha1, const char *base, int baselen,
89 html("'>"); 89 html("'>");
90 html_txt(name); 90 html_txt(name);
91 html("</a>"); 91 html("</a>");
92 } else if (S_ISDIR(mode)) { 92 } else if (S_ISDIR(mode)) {
93 cgit_tree_link(name, NULL, "ls-dir", cgit_query_head, 93 cgit_tree_link(name, NULL, "ls-dir", ctx.qry.head,
94 curr_rev, fullpath); 94 curr_rev, fullpath);
95 } else { 95 } else {
96 cgit_tree_link(name, NULL, "ls-blob", cgit_query_head, 96 cgit_tree_link(name, NULL, "ls-blob", ctx.qry.head,
97 curr_rev, fullpath); 97 curr_rev, fullpath);
98 } 98 }
99 htmlf("</td><td class='ls-size'>%li</td>", size); 99 htmlf("</td><td class='ls-size'>%li</td>", size);
100 100
101 html("<td>"); 101 html("<td>");
102 cgit_log_link("log", NULL, "button", cgit_query_head, curr_rev, 102 cgit_log_link("log", NULL, "button", ctx.qry.head, curr_rev,
103 fullpath, 0, NULL, NULL); 103 fullpath, 0, NULL, NULL);
104 html("</td></tr>\n"); 104 html("</td></tr>\n");
105 free(name); 105 free(name);
106 return 0; 106 return 0;
@@ -152,12 +152,12 @@ static int walk_tree(const unsigned char *sha1, const char *base, int baselen,
152 152
153 if (state == 0) { 153 if (state == 0) {
154 memcpy(buffer, base, baselen); 154 memcpy(buffer, base, baselen);
155 strcpy(buffer+baselen, pathname); 155 strcpy(buffer+baselen, pathname);
156 url = cgit_pageurl(cgit_query_repo, "tree", 156 url = cgit_pageurl(ctx.qry.repo, "tree",
157 fmt("h=%s&amp;path=%s", curr_rev, buffer)); 157 fmt("h=%s&amp;path=%s", curr_rev, buffer));
158 html("/"); 158 html("/");
159 cgit_tree_link(xstrdup(pathname), NULL, NULL, cgit_query_head, 159 cgit_tree_link(xstrdup(pathname), NULL, NULL, ctx.qry.head,
160 curr_rev, buffer); 160 curr_rev, buffer);
161 161
162 if (strcmp(match_path, buffer)) 162 if (strcmp(match_path, buffer))
163 return READ_TREE_RECURSIVE; 163 return READ_TREE_RECURSIVE;
@@ -187,9 +187,9 @@ void cgit_print_tree(const char *rev, char *path)
187 struct commit *commit; 187 struct commit *commit;
188 const char *paths[] = {path, NULL}; 188 const char *paths[] = {path, NULL};
189 189
190 if (!rev) 190 if (!rev)
191 rev = cgit_query_head; 191 rev = ctx.qry.head;
192 192
193 curr_rev = xstrdup(rev); 193 curr_rev = xstrdup(rev);
194 if (get_sha1(rev, sha1)) { 194 if (get_sha1(rev, sha1)) {
195 cgit_print_error(fmt("Invalid revision name: %s", rev)); 195 cgit_print_error(fmt("Invalid revision name: %s", rev));
@@ -201,9 +201,9 @@ void cgit_print_tree(const char *rev, char *path)
201 return; 201 return;
202 } 202 }
203 203
204 html("path: <a href='"); 204 html("path: <a href='");
205 html_attr(cgit_pageurl(cgit_query_repo, "tree", fmt("h=%s", rev))); 205 html_attr(cgit_pageurl(ctx.qry.repo, "tree", fmt("h=%s", rev)));
206 html("'>root</a>"); 206 html("'>root</a>");
207 207
208 if (path == NULL) { 208 if (path == NULL) {
209 ls_tree(commit->tree->object.sha1, NULL); 209 ls_tree(commit->tree->object.sha1, NULL);