2006-12-09 14:18:17 +00:00
|
|
|
#ifndef CGIT_H
|
|
|
|
#define CGIT_H
|
|
|
|
|
2007-05-08 20:40:59 +00:00
|
|
|
|
|
|
|
#include <git-compat-util.h>
|
|
|
|
#include <cache.h>
|
|
|
|
#include <grep.h>
|
|
|
|
#include <object.h>
|
|
|
|
#include <tree.h>
|
|
|
|
#include <commit.h>
|
|
|
|
#include <tag.h>
|
|
|
|
#include <diff.h>
|
|
|
|
#include <diffcore.h>
|
|
|
|
#include <refs.h>
|
|
|
|
#include <revision.h>
|
|
|
|
#include <log-tree.h>
|
|
|
|
#include <archive.h>
|
|
|
|
#include <xdiff/xdiff.h>
|
|
|
|
|
2006-12-10 21:31:36 +00:00
|
|
|
|
|
|
|
typedef void (*configfn)(const char *name, const char *value);
|
2007-05-13 09:24:23 +00:00
|
|
|
typedef void (*filepair_fn)(struct diff_filepair *pair);
|
2007-05-13 12:21:19 +00:00
|
|
|
typedef void (*linediff_fn)(char *line, int len);
|
2006-12-10 21:31:36 +00:00
|
|
|
|
|
|
|
struct cacheitem {
|
|
|
|
char *name;
|
|
|
|
struct stat st;
|
|
|
|
int ttl;
|
|
|
|
int fd;
|
|
|
|
};
|
|
|
|
|
2007-02-03 14:02:55 +00:00
|
|
|
struct repoinfo {
|
|
|
|
char *url;
|
|
|
|
char *name;
|
|
|
|
char *path;
|
|
|
|
char *desc;
|
|
|
|
char *owner;
|
2007-05-15 22:14:51 +00:00
|
|
|
char *defbranch;
|
2007-05-18 20:48:22 +00:00
|
|
|
char *group;
|
2007-05-11 10:12:48 +00:00
|
|
|
char *module_link;
|
2007-02-08 13:47:56 +00:00
|
|
|
int snapshots;
|
2007-05-18 11:55:52 +00:00
|
|
|
int enable_log_filecount;
|
|
|
|
int enable_log_linecount;
|
2007-02-03 14:02:55 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct repolist {
|
|
|
|
int length;
|
|
|
|
int count;
|
|
|
|
struct repoinfo *repos;
|
|
|
|
};
|
|
|
|
|
2006-12-15 17:17:36 +00:00
|
|
|
struct commitinfo {
|
|
|
|
struct commit *commit;
|
|
|
|
char *author;
|
2006-12-16 13:25:41 +00:00
|
|
|
char *author_email;
|
|
|
|
unsigned long author_date;
|
2006-12-15 17:17:36 +00:00
|
|
|
char *committer;
|
2006-12-16 13:25:41 +00:00
|
|
|
char *committer_email;
|
|
|
|
unsigned long committer_date;
|
2006-12-15 17:17:36 +00:00
|
|
|
char *subject;
|
|
|
|
char *msg;
|
|
|
|
};
|
|
|
|
|
2007-01-17 00:09:51 +00:00
|
|
|
struct taginfo {
|
|
|
|
char *tagger;
|
|
|
|
char *tagger_email;
|
|
|
|
int tagger_date;
|
|
|
|
char *msg;
|
|
|
|
};
|
|
|
|
|
2006-12-11 15:38:30 +00:00
|
|
|
extern const char cgit_version[];
|
|
|
|
|
2007-02-03 14:02:55 +00:00
|
|
|
extern struct repolist cgit_repolist;
|
|
|
|
extern struct repoinfo *cgit_repo;
|
|
|
|
|
2006-12-10 21:31:36 +00:00
|
|
|
extern char *cgit_root_title;
|
|
|
|
extern char *cgit_css;
|
|
|
|
extern char *cgit_logo;
|
|
|
|
extern char *cgit_logo_link;
|
2007-05-11 10:12:48 +00:00
|
|
|
extern char *cgit_module_link;
|
2006-12-10 21:31:36 +00:00
|
|
|
extern char *cgit_virtual_root;
|
2007-05-14 22:48:31 +00:00
|
|
|
extern char *cgit_script_name;
|
2006-12-10 21:31:36 +00:00
|
|
|
extern char *cgit_cache_root;
|
2007-05-18 20:48:22 +00:00
|
|
|
extern char *cgit_repo_group;
|
2006-12-10 21:31:36 +00:00
|
|
|
|
2006-12-16 12:33:32 +00:00
|
|
|
extern int cgit_nocache;
|
2007-02-08 13:47:56 +00:00
|
|
|
extern int cgit_snapshots;
|
2007-05-18 11:55:52 +00:00
|
|
|
extern int cgit_enable_log_filecount;
|
|
|
|
extern int cgit_enable_log_linecount;
|
2006-12-11 11:10:12 +00:00
|
|
|
extern int cgit_max_lock_attempts;
|
2006-12-10 21:31:36 +00:00
|
|
|
extern int cgit_cache_root_ttl;
|
|
|
|
extern int cgit_cache_repo_ttl;
|
|
|
|
extern int cgit_cache_dynamic_ttl;
|
|
|
|
extern int cgit_cache_static_ttl;
|
|
|
|
extern int cgit_cache_max_create_time;
|
|
|
|
|
2007-01-28 11:17:03 +00:00
|
|
|
extern int cgit_max_msg_len;
|
2007-05-16 08:45:45 +00:00
|
|
|
extern int cgit_max_repodesc_len;
|
2007-05-13 15:15:06 +00:00
|
|
|
extern int cgit_max_commit_count;
|
2007-01-28 11:17:03 +00:00
|
|
|
|
2006-12-10 21:31:36 +00:00
|
|
|
extern int cgit_query_has_symref;
|
|
|
|
extern int cgit_query_has_sha1;
|
|
|
|
|
|
|
|
extern char *cgit_querystring;
|
|
|
|
extern char *cgit_query_repo;
|
|
|
|
extern char *cgit_query_page;
|
2006-12-28 01:01:49 +00:00
|
|
|
extern char *cgit_query_search;
|
2006-12-10 21:31:36 +00:00
|
|
|
extern char *cgit_query_head;
|
|
|
|
extern char *cgit_query_sha1;
|
2006-12-20 21:48:27 +00:00
|
|
|
extern char *cgit_query_sha2;
|
2007-01-11 23:46:17 +00:00
|
|
|
extern char *cgit_query_path;
|
2007-02-08 12:53:13 +00:00
|
|
|
extern char *cgit_query_name;
|
2006-12-13 23:40:34 +00:00
|
|
|
extern int cgit_query_ofs;
|
2006-12-10 21:31:36 +00:00
|
|
|
|
|
|
|
extern int htmlfd;
|
2006-12-09 14:18:17 +00:00
|
|
|
|
2006-12-11 16:25:41 +00:00
|
|
|
extern void cgit_global_config_cb(const char *name, const char *value);
|
|
|
|
extern void cgit_repo_config_cb(const char *name, const char *value);
|
|
|
|
extern void cgit_querystring_cb(const char *name, const char *value);
|
|
|
|
|
2007-02-08 12:53:13 +00:00
|
|
|
extern int chk_zero(int result, char *msg);
|
|
|
|
extern int chk_positive(int result, char *msg);
|
|
|
|
|
2007-01-04 15:53:03 +00:00
|
|
|
extern int hextoint(char c);
|
|
|
|
|
2006-12-16 13:58:20 +00:00
|
|
|
extern void *cgit_free_commitinfo(struct commitinfo *info);
|
2007-05-13 12:21:19 +00:00
|
|
|
|
|
|
|
extern int cgit_diff_files(const unsigned char *old_sha1,
|
|
|
|
const unsigned char *new_sha1,
|
|
|
|
linediff_fn fn);
|
|
|
|
|
2007-05-13 09:24:23 +00:00
|
|
|
extern void cgit_diff_tree(const unsigned char *old_sha1,
|
|
|
|
const unsigned char *new_sha1,
|
|
|
|
filepair_fn fn);
|
2007-05-13 12:21:19 +00:00
|
|
|
|
2007-05-13 09:24:23 +00:00
|
|
|
extern void cgit_diff_commit(struct commit *commit, filepair_fn fn);
|
2006-12-16 13:58:20 +00:00
|
|
|
|
2006-12-09 14:18:17 +00:00
|
|
|
extern char *fmt(const char *format,...);
|
|
|
|
|
|
|
|
extern void html(const char *txt);
|
|
|
|
extern void htmlf(const char *format,...);
|
|
|
|
extern void html_txt(char *txt);
|
2006-12-21 23:58:18 +00:00
|
|
|
extern void html_ntxt(int len, char *txt);
|
2006-12-09 14:18:17 +00:00
|
|
|
extern void html_attr(char *txt);
|
2006-12-28 01:01:49 +00:00
|
|
|
extern void html_hidden(char *name, char *value);
|
2006-12-09 14:18:17 +00:00
|
|
|
extern void html_link_open(char *url, char *title, char *class);
|
|
|
|
extern void html_link_close(void);
|
2006-12-17 22:07:28 +00:00
|
|
|
extern void html_filemode(unsigned short mode);
|
2006-12-09 14:18:17 +00:00
|
|
|
|
|
|
|
extern int cgit_read_config(const char *filename, configfn fn);
|
2006-12-11 15:11:40 +00:00
|
|
|
extern int cgit_parse_query(char *txt, configfn fn);
|
2006-12-15 17:17:36 +00:00
|
|
|
extern struct commitinfo *cgit_parse_commit(struct commit *commit);
|
2007-01-17 00:09:51 +00:00
|
|
|
extern struct taginfo *cgit_parse_tag(struct tag *tag);
|
2006-12-09 14:18:17 +00:00
|
|
|
|
2007-01-11 23:24:35 +00:00
|
|
|
extern char *cache_safe_filename(const char *unsafe);
|
2006-12-10 21:31:36 +00:00
|
|
|
extern int cache_lock(struct cacheitem *item);
|
|
|
|
extern int cache_unlock(struct cacheitem *item);
|
2006-12-11 21:53:50 +00:00
|
|
|
extern int cache_cancel_lock(struct cacheitem *item);
|
2006-12-11 08:57:58 +00:00
|
|
|
extern int cache_exist(struct cacheitem *item);
|
2006-12-10 21:31:36 +00:00
|
|
|
extern int cache_expired(struct cacheitem *item);
|
|
|
|
|
2006-12-11 15:48:03 +00:00
|
|
|
extern char *cgit_repourl(const char *reponame);
|
2007-05-15 22:58:35 +00:00
|
|
|
extern char *cgit_pageurl(const char *reponame, const char *pagename,
|
2006-12-11 15:48:03 +00:00
|
|
|
const char *query);
|
|
|
|
|
2006-12-11 15:38:30 +00:00
|
|
|
extern void cgit_print_error(char *msg);
|
2006-12-15 23:33:28 +00:00
|
|
|
extern void cgit_print_date(unsigned long secs);
|
2006-12-11 15:38:30 +00:00
|
|
|
extern void cgit_print_docstart(char *title, struct cacheitem *item);
|
|
|
|
extern void cgit_print_docend();
|
2006-12-28 01:01:49 +00:00
|
|
|
extern void cgit_print_pageheader(char *title, int show_search);
|
2007-05-15 22:58:35 +00:00
|
|
|
extern void cgit_print_snapshot_start(const char *mimetype,
|
|
|
|
const char *filename,
|
2007-02-08 12:53:13 +00:00
|
|
|
struct cacheitem *item);
|
2006-12-11 15:38:30 +00:00
|
|
|
|
2006-12-11 15:48:03 +00:00
|
|
|
extern void cgit_print_repolist(struct cacheitem *item);
|
2006-12-11 16:04:19 +00:00
|
|
|
extern void cgit_print_summary();
|
2007-05-14 09:10:59 +00:00
|
|
|
extern void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *path);
|
2007-05-08 21:52:56 +00:00
|
|
|
extern void cgit_print_view(const char *hex, char *path);
|
2007-05-08 22:48:09 +00:00
|
|
|
extern void cgit_print_blob(struct cacheitem *item, const char *hex, char *path);
|
2007-05-14 09:10:59 +00:00
|
|
|
extern void cgit_print_tree(const char *rev, const char *hex, char *path);
|
2006-12-15 23:19:56 +00:00
|
|
|
extern void cgit_print_commit(const char *hex);
|
2007-05-15 22:58:35 +00:00
|
|
|
extern void cgit_print_diff(const char *head, const char *old_hex, const char *new_hex,
|
|
|
|
char *path);
|
|
|
|
extern void cgit_print_snapshot(struct cacheitem *item, const char *hex,
|
2007-02-08 12:53:13 +00:00
|
|
|
const char *format, const char *prefix,
|
|
|
|
const char *filename);
|
2006-12-11 15:48:03 +00:00
|
|
|
|
2006-12-09 14:18:17 +00:00
|
|
|
#endif /* CGIT_H */
|