summaryrefslogtreecommitdiffabout
authorLars Hjemli <hjemli@gmail.com>2008-03-25 01:00:09 (UTC)
committer Lars Hjemli <hjemli@gmail.com>2008-03-25 01:00:09 (UTC)
commitdc3282f0baa14949439593729a45fbe143e3622c (patch) (side-by-side diff)
tree2eb7eabeb11c4a1c1e132d396ac5c621caf48414
parentc60781d677ee3b2e53b1f3078fef763622e5effe (diff)
downloadcgit-dc3282f0baa14949439593729a45fbe143e3622c.zip
cgit-dc3282f0baa14949439593729a45fbe143e3622c.tar.gz
cgit-dc3282f0baa14949439593729a45fbe143e3622c.tar.bz2
Remove global and obsolete cgit_cmd
This variable was obsoleted by cmd.c. Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--cgit.c2
-rw-r--r--cgit.h1
2 files changed, 1 insertions, 2 deletions
diff --git a/cgit.c b/cgit.c
index 3943a0f..f749b6b 100644
--- a/cgit.c
+++ b/cgit.c
@@ -136,97 +136,97 @@ static void querystring_cb(const char *name, const char *value)
}
}
static void prepare_context(struct cgit_context *ctx)
{
memset(ctx, 0, sizeof(ctx));
ctx->cfg.agefile = "info/web/last-modified";
ctx->cfg.cache_dynamic_ttl = 5;
ctx->cfg.cache_max_create_time = 5;
ctx->cfg.cache_repo_ttl = 5;
ctx->cfg.cache_root = CGIT_CACHE_ROOT;
ctx->cfg.cache_root_ttl = 5;
ctx->cfg.cache_static_ttl = -1;
ctx->cfg.css = "/cgit.css";
ctx->cfg.logo = "/git-logo.png";
ctx->cfg.max_commit_count = 50;
ctx->cfg.max_lock_attempts = 5;
ctx->cfg.max_msg_len = 60;
ctx->cfg.max_repodesc_len = 60;
ctx->cfg.module_link = "./?repo=%s&page=commit&id=%s";
ctx->cfg.renamelimit = -1;
ctx->cfg.robots = "index, nofollow";
ctx->cfg.root_title = "Git repository browser";
ctx->cfg.script_name = CGIT_SCRIPT_NAME;
ctx->page.mimetype = "text/html";
ctx->page.charset = PAGE_ENCODING;
ctx->page.filename = NULL;
}
static int cgit_prepare_cache(struct cacheitem *item)
{
if (!ctx.repo && ctx.qry.repo) {
ctx.page.title = fmt("%s - %s", ctx.cfg.root_title,
"Bad request");
cgit_print_http_headers(&ctx);
cgit_print_docstart(&ctx);
cgit_print_pageheader(&ctx);
cgit_print_error(fmt("Unknown repo: %s", ctx.qry.repo));
cgit_print_docend();
return 0;
}
if (!ctx.repo) {
item->name = xstrdup(fmt("%s/index.html", ctx.cfg.cache_root));
item->ttl = ctx.cfg.cache_root_ttl;
return 1;
}
- if (!cgit_cmd) {
+ if (!ctx.qry.page) {
item->name = xstrdup(fmt("%s/%s/index.%s.html", ctx.cfg.cache_root,
cache_safe_filename(ctx.repo->url),
cache_safe_filename(ctx.qry.raw)));
item->ttl = ctx.cfg.cache_repo_ttl;
} else {
item->name = xstrdup(fmt("%s/%s/%s/%s.html", ctx.cfg.cache_root,
cache_safe_filename(ctx.repo->url),
ctx.qry.page,
cache_safe_filename(ctx.qry.raw)));
if (ctx.qry.has_symref)
item->ttl = ctx.cfg.cache_dynamic_ttl;
else if (ctx.qry.has_sha1)
item->ttl = ctx.cfg.cache_static_ttl;
else
item->ttl = ctx.cfg.cache_repo_ttl;
}
return 1;
}
struct refmatch {
char *req_ref;
char *first_ref;
int match;
};
int find_current_ref(const char *refname, const unsigned char *sha1,
int flags, void *cb_data)
{
struct refmatch *info;
info = (struct refmatch *)cb_data;
if (!strcmp(refname, info->req_ref))
info->match = 1;
if (!info->first_ref)
info->first_ref = xstrdup(refname);
return info->match;
}
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;
diff --git a/cgit.h b/cgit.h
index b58676b..e82e9aa 100644
--- a/cgit.h
+++ b/cgit.h
@@ -144,97 +144,96 @@ struct cgit_config {
int cache_dynamic_ttl;
int cache_max_create_time;
int cache_repo_ttl;
int cache_root_ttl;
int cache_static_ttl;
int enable_index_links;
int enable_log_filecount;
int enable_log_linecount;
int max_commit_count;
int max_lock_attempts;
int max_msg_len;
int max_repodesc_len;
int nocache;
int renamelimit;
int snapshots;
int summary_branches;
int summary_log;
int summary_tags;
};
struct cgit_page {
time_t modified;
time_t expires;
char *mimetype;
char *charset;
char *filename;
char *title;
};
struct cgit_context {
struct cgit_query qry;
struct cgit_config cfg;
struct cgit_repo *repo;
struct cgit_page page;
};
struct cgit_snapshot_format {
const char *suffix;
const char *mimetype;
write_archive_fn_t write_func;
int bit;
};
extern const char *cgit_version;
extern struct cgit_repolist cgit_repolist;
extern struct cgit_context ctx;
extern const struct cgit_snapshot_format cgit_snapshot_formats[];
-extern int cgit_cmd;
extern struct cgit_repo *cgit_add_repo(const char *url);
extern struct cgit_repo *cgit_get_repoinfo(const char *url);
extern void cgit_repo_config_cb(const char *name, const char *value);
extern int chk_zero(int result, char *msg);
extern int chk_positive(int result, char *msg);
extern int chk_non_negative(int result, char *msg);
extern int hextoint(char c);
extern char *trim_end(const char *str, char c);
extern char *strlpart(char *txt, int maxlen);
extern char *strrpart(char *txt, int maxlen);
extern void cgit_add_ref(struct reflist *list, struct refinfo *ref);
extern int cgit_refs_cb(const char *refname, const unsigned char *sha1,
int flags, void *cb_data);
extern void *cgit_free_commitinfo(struct commitinfo *info);
extern int cgit_diff_files(const unsigned char *old_sha1,
const unsigned char *new_sha1,
linediff_fn fn);
extern void cgit_diff_tree(const unsigned char *old_sha1,
const unsigned char *new_sha1,
filepair_fn fn, const char *prefix);
extern void cgit_diff_commit(struct commit *commit, filepair_fn fn);
extern char *fmt(const char *format,...);
extern int cgit_read_config(const char *filename, configfn fn);
extern int cgit_parse_query(char *txt, configfn fn);
extern struct commitinfo *cgit_parse_commit(struct commit *commit);
extern struct taginfo *cgit_parse_tag(struct tag *tag);
extern void cgit_parse_url(const char *url);
extern char *cache_safe_filename(const char *unsafe);
extern int cache_lock(struct cacheitem *item);
extern int cache_unlock(struct cacheitem *item);
extern int cache_cancel_lock(struct cacheitem *item);
extern int cache_exist(struct cacheitem *item);
extern int cache_expired(struct cacheitem *item);
extern const char *cgit_repobasename(const char *reponame);
extern int cgit_parse_snapshots_mask(const char *str);