summaryrefslogtreecommitdiffabout
path: root/ui-tree.c
authorLars Hjemli <hjemli@gmail.com>2008-02-16 10:53:40 (UTC)
committer Lars Hjemli <hjemli@gmail.com>2008-02-16 11:07:28 (UTC)
commitd14d77fe95c3b6224b40df9b101dded0deea913c (patch) (side-by-side diff)
tree7e0d9c8f2c0f86b8946aea0bb823085c33b164b3 /ui-tree.c
parente5ed227ef0da561e2bde8646ec816842392377ee (diff)
downloadcgit-d14d77fe95c3b6224b40df9b101dded0deea913c.zip
cgit-d14d77fe95c3b6224b40df9b101dded0deea913c.tar.gz
cgit-d14d77fe95c3b6224b40df9b101dded0deea913c.tar.bz2
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') (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
@@ -36,3 +36,3 @@ static void print_object(const unsigned char *sha1, char *path)
html(" blob: <a href='");
- html_attr(cgit_pageurl(cgit_query_repo, "blob", fmt("id=%s", sha1_to_hex(sha1))));
+ html_attr(cgit_pageurl(ctx.qry.repo, "blob", fmt("id=%s", sha1_to_hex(sha1))));
htmlf("'>%s</a>",sha1_to_hex(sha1));
@@ -69,4 +69,4 @@ static int ls_item(const unsigned char *sha1, const char *base, int baselen,
name = xstrdup(pathname);
- fullpath = fmt("%s%s%s", cgit_query_path ? cgit_query_path : "",
- cgit_query_path ? "/" : "", name);
+ fullpath = fmt("%s%s%s", ctx.qry.path ? ctx.qry.path : "",
+ ctx.qry.path ? "/" : "", name);
@@ -92,6 +92,6 @@ static int ls_item(const unsigned char *sha1, const char *base, int baselen,
} else if (S_ISDIR(mode)) {
- cgit_tree_link(name, NULL, "ls-dir", cgit_query_head,
+ cgit_tree_link(name, NULL, "ls-dir", ctx.qry.head,
curr_rev, fullpath);
} else {
- cgit_tree_link(name, NULL, "ls-blob", cgit_query_head,
+ cgit_tree_link(name, NULL, "ls-blob", ctx.qry.head,
curr_rev, fullpath);
@@ -101,3 +101,3 @@ static int ls_item(const unsigned char *sha1, const char *base, int baselen,
html("<td>");
- cgit_log_link("log", NULL, "button", cgit_query_head, curr_rev,
+ cgit_log_link("log", NULL, "button", ctx.qry.head, curr_rev,
fullpath, 0, NULL, NULL);
@@ -155,6 +155,6 @@ static int walk_tree(const unsigned char *sha1, const char *base, int baselen,
strcpy(buffer+baselen, pathname);
- url = cgit_pageurl(cgit_query_repo, "tree",
+ url = cgit_pageurl(ctx.qry.repo, "tree",
fmt("h=%s&amp;path=%s", curr_rev, buffer));
html("/");
- cgit_tree_link(xstrdup(pathname), NULL, NULL, cgit_query_head,
+ cgit_tree_link(xstrdup(pathname), NULL, NULL, ctx.qry.head,
curr_rev, buffer);
@@ -190,3 +190,3 @@ void cgit_print_tree(const char *rev, char *path)
if (!rev)
- rev = cgit_query_head;
+ rev = ctx.qry.head;
@@ -204,3 +204,3 @@ void cgit_print_tree(const char *rev, char *path)
html("path: <a href='");
- html_attr(cgit_pageurl(cgit_query_repo, "tree", fmt("h=%s", rev)));
+ html_attr(cgit_pageurl(ctx.qry.repo, "tree", fmt("h=%s", rev)));
html("'>root</a>");