summaryrefslogtreecommitdiff
path: root/ui-commit.c
diff options
context:
space:
mode:
authorLars Hjemli <hjemli@gmail.com>2008-04-08 21:29:21 +0200
committerLars Hjemli <hjemli@gmail.com>2008-04-08 21:29:21 +0200
commit23296ad648c0e2a9e3cf40a3de322b10ad25cce3 (patch)
tree136493d8228b0ff4971feb06b0e8aee296367b00 /ui-commit.c
parente2a44cf0923398396b7a321d5ce894ad3bf6f580 (diff)
parentc6f747649ace1a92ed5dfaae9cc1ea3affe0bf51 (diff)
downloadcgit-23296ad648c0e2a9e3cf40a3de322b10ad25cce3.tar.gz
cgit-23296ad648c0e2a9e3cf40a3de322b10ad25cce3.tar.bz2
cgit-23296ad648c0e2a9e3cf40a3de322b10ad25cce3.zip
Merge branch 'lh/cleanup'
* lh/cleanup: (21 commits) Reset ctx.repo to NULL when the config parser is finished Move cgit_parse_query() from parsing.c to html.c as http_parse_querystring() Move function for configfile parsing into configfile.[ch] Add cache.h Remove global and obsolete cgit_cmd Makefile: copy the QUIET constructs from the Makefile in git.git Move cgit_version from shared.c to cgit.c Makefile: autobuild dependency rules Initial Makefile cleanup Move non-generic functions from shared.c to cgit.c Add ui-shared.h Add separate header-files for each page/view Refactor snapshot support Add command dispatcher Remove obsolete cacheitem parameter to ui-functions Add struct cgit_page to cgit_context Introduce html.h Improve initialization of git directory Move cgit_repo into cgit_context Add all config variables into struct cgit_context ...
Diffstat (limited to '')
-rw-r--r--ui-commit.c26
1 files changed, 14 insertions, 12 deletions
diff --git a/ui-commit.c b/ui-commit.c
index bd55a33..8019e36 100644
--- a/ui-commit.c
+++ b/ui-commit.c
@@ -7,6 +7,8 @@
*/
#include "cgit.h"
+#include "html.h"
+#include "ui-shared.h"
static int files, slots;
static int total_adds, total_rems, max_changes;
@@ -62,20 +64,20 @@ void print_fileinfo(struct fileinfo *info)
html("<tr>");
htmlf("<td class='mode'>");
if (is_null_sha1(info->new_sha1)) {
- html_filemode(info->old_mode);
+ cgit_print_filemode(info->old_mode);
} else {
- html_filemode(info->new_mode);
+ cgit_print_filemode(info->new_mode);
}
if (info->old_mode != info->new_mode &&
!is_null_sha1(info->old_sha1) &&
!is_null_sha1(info->new_sha1)) {
html("<span class='modechange'>[");
- html_filemode(info->old_mode);
+ cgit_print_filemode(info->old_mode);
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 +145,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 +177,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,16 +190,16 @@ 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) {
+ if (ctx.repo->snapshots) {
html("<tr><th>download</th><td colspan='2' class='sha1'>");
- cgit_print_snapshot_links(cgit_query_repo, cgit_query_head,
- hex, cgit_repo->snapshots);
+ cgit_print_snapshot_links(ctx.qry.repo, ctx.qry.head,
+ hex, ctx.repo->snapshots);
html("</td></tr>");
}
html("</table>\n");
@@ -218,7 +220,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>");
}