From 23296ad648c0e2a9e3cf40a3de322b10ad25cce3 Mon Sep 17 00:00:00 2001 From: Lars Hjemli Date: Tue, 08 Apr 2008 19:29:21 +0000 Subject: 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 ... --- (limited to 'ui-commit.c') 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(""); htmlf(""); 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("["); - html_filemode(info->old_mode); + cgit_print_filemode(info->old_mode); html("]"); } htmlf("", 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("tree"); 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("\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("parent" ""); 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(")"); } - if (cgit_repo->snapshots) { + if (ctx.repo->snapshots) { html("download"); - 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(""); } html("\n"); @@ -218,7 +220,7 @@ void cgit_print_commit(char *hex) html("
"); 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(")
"); } -- cgit v0.9.0.2