summaryrefslogtreecommitdiffabout
Side-by-side diff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--cgit.c12
-rw-r--r--cgit.h12
-rw-r--r--ui-blob.c2
-rw-r--r--ui-patch.c2
-rw-r--r--ui-repolist.c2
-rw-r--r--ui-snapshot.c3
6 files changed, 16 insertions, 17 deletions
diff --git a/cgit.c b/cgit.c
index d0f6905..a83f0be 100644
--- a/cgit.c
+++ b/cgit.c
@@ -72,25 +72,25 @@ char *find_default_branch(struct cgit_repo *repo)
struct refmatch info;
info.req_ref = repo->defbranch;
info.first_ref = NULL;
info.match = 0;
for_each_branch_ref(find_current_ref, &info);
if (info.match)
return info.req_ref;
else
return info.first_ref;
}
-static void cgit_print_repo_page(struct cacheitem *item)
+static void cgit_print_repo_page()
{
char *tmp;
int show_search;
unsigned char sha1[20];
int nongit = 0;
setenv("GIT_DIR", ctx.repo->path, 1);
setup_git_directory_gently(&nongit);
if (nongit) {
ctx.page.title = fmt("%s - %s", ctx.cfg.root_title,
"config error");
tmp = fmt("Not a git repository: '%s'", ctx.repo->path);
@@ -123,38 +123,38 @@ static void cgit_print_repo_page(struct cacheitem *item)
if (get_sha1(ctx.qry.head, sha1)) {
tmp = xstrdup(ctx.qry.head);
ctx.qry.head = ctx.repo->defbranch;
cgit_print_http_headers(&ctx);
cgit_print_docstart(&ctx);
cgit_print_pageheader(&ctx);
cgit_print_error(fmt("Invalid branch: %s", tmp));
cgit_print_docend();
return;
}
if ((cgit_cmd == CMD_SNAPSHOT) && ctx.repo->snapshots) {
- cgit_print_snapshot(item, ctx.qry.head, ctx.qry.sha1,
+ cgit_print_snapshot(ctx.qry.head, ctx.qry.sha1,
cgit_repobasename(ctx.repo->url),
ctx.qry.path,
ctx.repo->snapshots );
return;
}
if (cgit_cmd == CMD_PATCH) {
- cgit_print_patch(ctx.qry.sha1, item);
+ cgit_print_patch(ctx.qry.sha1);
return;
}
if (cgit_cmd == CMD_BLOB) {
- cgit_print_blob(item, ctx.qry.sha1, ctx.qry.path);
+ cgit_print_blob(ctx.qry.sha1, ctx.qry.path);
return;
}
show_search = (cgit_cmd == CMD_LOG);
cgit_print_http_headers(&ctx);
cgit_print_docstart(&ctx);
if (!cgit_cmd) {
cgit_print_pageheader(&ctx);
cgit_print_summary();
cgit_print_docend();
return;
}
@@ -201,27 +201,27 @@ static void cgit_fill_cache(struct cacheitem *item, int use_cache)
int stdout2;
if (use_cache) {
stdout2 = chk_positive(dup(STDOUT_FILENO),
"Preserving STDOUT");
chk_zero(close(STDOUT_FILENO), "Closing STDOUT");
chk_positive(dup2(item->fd, STDOUT_FILENO), "Dup2(cachefile)");
}
ctx.page.modified = time(NULL);
ctx.page.expires = ctx.page.modified + ttl_seconds(item->ttl);
if (ctx.repo)
- cgit_print_repo_page(item);
+ cgit_print_repo_page();
else
- cgit_print_repolist(item);
+ cgit_print_repolist();
if (use_cache) {
chk_zero(close(STDOUT_FILENO), "Close redirected STDOUT");
chk_positive(dup2(stdout2, STDOUT_FILENO),
"Restoring original STDOUT");
chk_zero(close(stdout2), "Closing temporary STDOUT");
}
}
static void cgit_check_cache(struct cacheitem *item)
{
int i = 0;
diff --git a/cgit.h b/cgit.h
index 8ab8e07..40e2d40 100644
--- a/cgit.h
+++ b/cgit.h
@@ -269,31 +269,31 @@ extern void cgit_object_link(struct object *obj);
extern void cgit_print_error(char *msg);
extern void cgit_print_date(time_t secs, char *format);
extern void cgit_print_age(time_t t, time_t max_relative, char *format);
extern void cgit_print_http_headers(struct cgit_context *ctx);
extern void cgit_print_docstart(struct cgit_context *ctx);
extern void cgit_print_docend();
extern void cgit_print_pageheader(struct cgit_context *ctx);
extern void cgit_print_filemode(unsigned short mode);
extern void cgit_print_branches(int maxcount);
extern void cgit_print_tags(int maxcount);
-extern void cgit_print_repolist(struct cacheitem *item);
+extern void cgit_print_repolist();
extern void cgit_print_summary();
extern void cgit_print_log(const char *tip, int ofs, int cnt, char *grep,
char *pattern, char *path, int pager);
-extern void cgit_print_blob(struct cacheitem *item, const char *hex, char *path);
+extern void cgit_print_blob(const char *hex, char *path);
extern void cgit_print_tree(const char *rev, char *path);
extern void cgit_print_commit(char *hex);
extern void cgit_print_refs();
extern void cgit_print_tag(char *revname);
extern void cgit_print_diff(const char *new_hex, const char *old_hex, const char *prefix);
-extern void cgit_print_patch(char *hex, struct cacheitem *item);
-extern void cgit_print_snapshot(struct cacheitem *item, const char *head,
- const char *hex, const char *prefix,
- const char *filename, int snapshot);
+extern void cgit_print_patch(char *hex);
+extern void cgit_print_snapshot(const char *head, const char *hex,
+ const char *prefix, const char *filename,
+ int snapshot);
extern void cgit_print_snapshot_links(const char *repo, const char *head,
const char *hex, int snapshots);
extern int cgit_parse_snapshots_mask(const char *str);
#endif /* CGIT_H */
diff --git a/ui-blob.c b/ui-blob.c
index bd44574..3b29132 100644
--- a/ui-blob.c
+++ b/ui-blob.c
@@ -1,24 +1,24 @@
/* ui-blob.c: show blob content
*
* Copyright (C) 2008 Lars Hjemli
*
* Licensed under GNU General Public License v2
* (see COPYING for full license text)
*/
#include "cgit.h"
#include "html.h"
-void cgit_print_blob(struct cacheitem *item, const char *hex, char *path)
+void cgit_print_blob(const char *hex, char *path)
{
unsigned char sha1[20];
enum object_type type;
unsigned char *buf;
unsigned long size;
if (get_sha1_hex(hex, sha1)){
cgit_print_error(fmt("Bad hex value: %s", hex));
return;
}
diff --git a/ui-patch.c b/ui-patch.c
index a77f3f6..68ebb15 100644
--- a/ui-patch.c
+++ b/ui-patch.c
@@ -60,25 +60,25 @@ static void filepair_cb(struct diff_filepair *pair)
pair->two->sha1, pair->two->path, pair->two->mode);
if (S_ISGITLINK(pair->one->mode) || S_ISGITLINK(pair->two->mode)) {
if (S_ISGITLINK(pair->one->mode))
print_line(fmt("-Subproject %s", sha1_to_hex(pair->one->sha1)), 52);
if (S_ISGITLINK(pair->two->mode))
print_line(fmt("+Subproject %s", sha1_to_hex(pair->two->sha1)), 52);
return;
}
if (cgit_diff_files(pair->one->sha1, pair->two->sha1, print_line))
html("Error running diff");
}
-void cgit_print_patch(char *hex, struct cacheitem *item)
+void cgit_print_patch(char *hex)
{
struct commit *commit;
struct commitinfo *info;
unsigned char sha1[20], old_sha1[20];
char *patchname;
if (!hex)
hex = ctx.qry.head;
if (get_sha1(hex, sha1)) {
cgit_print_error(fmt("Bad object id: %s", hex));
return;
diff --git a/ui-repolist.c b/ui-repolist.c
index e663585..ad9b1bc 100644
--- a/ui-repolist.c
+++ b/ui-repolist.c
@@ -34,25 +34,25 @@ static void print_modtime(struct cgit_repo *repo)
path = fmt("%s/%s", repo->path, ctx.cfg.agefile);
if (stat(path, &s) == 0) {
cgit_print_age(read_agefile(path), -1, NULL);
return;
}
path = fmt("%s/refs/heads/%s", repo->path, repo->defbranch);
if (stat(path, &s) != 0)
return;
cgit_print_age(s.st_mtime, -1, NULL);
}
-void cgit_print_repolist(struct cacheitem *item)
+void cgit_print_repolist()
{
int i, columns = 4;
char *last_group = NULL;
if (ctx.cfg.enable_index_links)
columns++;
ctx.page.title = ctx.cfg.root_title;
cgit_print_http_headers(&ctx);
cgit_print_docstart(&ctx);
cgit_print_pageheader(&ctx);
diff --git a/ui-snapshot.c b/ui-snapshot.c
index 4449803..c741469 100644
--- a/ui-snapshot.c
+++ b/ui-snapshot.c
@@ -60,26 +60,25 @@ static const struct snapshot_archive_t {
const char *mimetype;
write_archive_fn_t write_func;
int bit;
} snapshot_archives[] = {
{ ".zip", "application/x-zip", write_zip_archive, 0x1 },
{ ".tar.gz", "application/x-tar", write_tar_gzip_archive, 0x2 },
{ ".tar.bz2", "application/x-tar", write_tar_bzip2_archive, 0x4 },
{ ".tar", "application/x-tar", write_tar_archive, 0x8 }
};
#define snapshot_archives_len (sizeof(snapshot_archives) / sizeof(*snapshot_archives))
-void cgit_print_snapshot(struct cacheitem *item, const char *head,
- const char *hex, const char *prefix,
+void cgit_print_snapshot(const char *head, const char *hex, const char *prefix,
const char *filename, int snapshots)
{
const struct snapshot_archive_t* sat;
struct archiver_args args;
struct commit *commit;
unsigned char sha1[20];
int f, sl, fnl = strlen(filename);
for(f=0; f<snapshot_archives_len; f++) {
sat = &snapshot_archives[f];
if(!(snapshots & sat->bit))
continue;