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>
This commit is contained in:
Lars Hjemli 2008-02-16 11:53:40 +01:00
parent e5ed227ef0
commit d14d77fe95
13 changed files with 156 additions and 164 deletions

View file

@ -75,7 +75,7 @@ void print_fileinfo(struct fileinfo *info)
html("]</span>");
}
htmlf("</td><td class='%s'>", class);
cgit_diff_link(info->new_path, NULL, NULL, cgit_query_head, curr_rev,
cgit_diff_link(info->new_path, NULL, NULL, ctx.qry.head, curr_rev,
NULL, info->new_path);
if (info->status == DIFF_STATUS_COPIED || info->status == DIFF_STATUS_RENAMED)
htmlf(" (%s from %s)",
@ -143,7 +143,7 @@ void cgit_print_commit(char *hex)
int i;
if (!hex)
hex = cgit_query_head;
hex = ctx.qry.head;
curr_rev = hex;
if (get_sha1(hex, sha1)) {
@ -175,7 +175,7 @@ void cgit_print_commit(char *hex)
html("<tr><th>tree</th><td colspan='2' class='sha1'>");
tmp = xstrdup(hex);
cgit_tree_link(sha1_to_hex(commit->tree->object.sha1), NULL, NULL,
cgit_query_head, tmp, NULL);
ctx.qry.head, tmp, NULL);
html("</td></tr>\n");
for (p = commit->parents; p ; p = p->next) {
parent = lookup_commit_reference(p->item->object.sha1);
@ -188,15 +188,15 @@ void cgit_print_commit(char *hex)
html("<tr><th>parent</th>"
"<td colspan='2' class='sha1'>");
cgit_commit_link(sha1_to_hex(p->item->object.sha1), NULL, NULL,
cgit_query_head, sha1_to_hex(p->item->object.sha1));
ctx.qry.head, sha1_to_hex(p->item->object.sha1));
html(" (");
cgit_diff_link("diff", NULL, NULL, cgit_query_head, hex,
cgit_diff_link("diff", NULL, NULL, ctx.qry.head, hex,
sha1_to_hex(p->item->object.sha1), NULL);
html(")</td></tr>");
}
if (cgit_repo->snapshots) {
html("<tr><th>download</th><td colspan='2' class='sha1'>");
cgit_print_snapshot_links(cgit_query_repo, cgit_query_head,
cgit_print_snapshot_links(ctx.qry.repo, ctx.qry.head,
hex, cgit_repo->snapshots);
html("</td></tr>");
}
@ -218,7 +218,7 @@ void cgit_print_commit(char *hex)
html("<div class='diffstat-summary'>");
htmlf("%d files changed, %d insertions, %d deletions (",
files, total_adds, total_rems);
cgit_diff_link("show diff", NULL, NULL, cgit_query_head, hex,
cgit_diff_link("show diff", NULL, NULL, ctx.qry.head, hex,
NULL, NULL);
html(")</div>");
}