diff options
author | Lars Hjemli <hjemli@gmail.com> | 2008-02-16 19:53:40 (JST) |
---|---|---|
committer | Lars Hjemli <hjemli@gmail.com> | 2008-02-16 20:07:28 (JST) |
commit | d14d77fe95c3b6224b40df9b101dded0deea913c (patch) | |
tree | 7e0d9c8f2c0f86b8946aea0bb823085c33b164b3 /ui-tree.c | |
parent | e5ed227ef0da561e2bde8646ec816842392377ee (diff) | |
download | cgit-d14d77fe95c3b6224b40df9b101dded0deea913c.zip cgit-d14d77fe95c3b6224b40df9b101dded0deea913c.tar.gz |
Introduce struct cgit_context
This struct will hold all the cgit runtime information currently found in
a multitude of global variables.
The first cleanup removes all querystring-related variables.
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Diffstat (limited to 'ui-tree.c')
-rw-r--r-- | ui-tree.c | 20 |
1 files changed, 10 insertions, 10 deletions
@@ -34,7 +34,7 @@ static void print_object(const unsigned char *sha1, char *path) | |||
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"); |
@@ -67,8 +67,8 @@ static int ls_item(const unsigned char *sha1, const char *base, int baselen, | |||
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)) { |
@@ -90,16 +90,16 @@ static int ls_item(const unsigned char *sha1, const char *base, int baselen, | |||
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); |
@@ -153,10 +153,10 @@ static int walk_tree(const unsigned char *sha1, const char *base, int baselen, | |||
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&path=%s", curr_rev, buffer)); | 157 | fmt("h=%s&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)) |
@@ -188,7 +188,7 @@ void cgit_print_tree(const char *rev, char *path) | |||
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)) { |
@@ -202,7 +202,7 @@ void cgit_print_tree(const char *rev, char *path) | |||
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) { |