#ifndef CGIT_H #define CGIT_H #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include /* * Dateformats used on misc. pages */ #define FMT_LONGDATE "%Y-%m-%d %H:%M:%S (%Z)" #define FMT_SHORTDATE "%Y-%m-%d" #define FMT_ATOMDATE "%Y-%m-%dT%H:%M:%SZ" /* * Limits used for relative dates */ #define TM_MIN 60 #define TM_HOUR (TM_MIN * 60) #define TM_DAY (TM_HOUR * 24) #define TM_WEEK (TM_DAY * 7) #define TM_YEAR (TM_DAY * 365) #define TM_MONTH (TM_YEAR / 12.0) /* * Default encoding */ #define PAGE_ENCODING "UTF-8" typedef void (*configfn)(const char *name, const char *value); typedef void (*filepair_fn)(struct diff_filepair *pair); typedef void (*linediff_fn)(char *line, int len); typedef enum { ABOUT, COMMIT, SOURCE, EMAIL, AUTH } filter_type; struct cgit_filter { int (*open)(struct cgit_filter *, va_list ap); int (*close)(struct cgit_filter *); void (*fprintf)(struct cgit_filter *, FILE *, const char *prefix); void (*cleanup)(struct cgit_filter *); int argument_count; }; struct cgit_exec_filter { struct cgit_filter base; char *cmd; char **argv; int old_stdout; int pipe_fh[2]; int pid; }; struct cgit_repo { char *url; char *name; char *path; char *desc; char *owner; char *defbranch; char *module_link; struct string_list readme; char *section; char *clone_url; char *logo; char *logo_link; int snapshots; int enable_commit_graph; int enable_log_filecount; int enable_log_linecount; int enable_remote_branches; int enable_subject_links; int max_stats; int branch_sort; int commit_sort; time_t mtime; struct cgit_filter *about_filter; struct cgit_filter *commit_filter; struct cgit_filter *source_filter; struct cgit_filter *email_filter; struct string_list submodules; }; typedef void (*repo_config_fn)(struct cgit_repo *repo, const char *name, const char *value); struct cgit_repolist { int length; int count; struct cgit_repo *repos; }; struct commitinfo { struct commit *commit; char *author; char *author_email; unsigned long author_date; char *committer; char *committer_email; unsigned long committer_date; char *subject; char *msg; char *msg_encoding; }; struct taginfo { char *tagger; char *tagger_email; unsigned long tagger_date; char *msg; }; struct refinfo { const char *refname; struct object *object; union { struct taginfo *tag; struct commitinfo *commit; }; }; struct reflist { struct refinfo **refs; int alloc; int count; }; struct cgit_query { int has_symref; int has_sha1; int has_ssdiff; char *raw; char *repo; char *page; char *search; char *grep; char *head; char *sha1; char *sha2; char *path; char *name; char *mimetype; char *url; char *period; int ofs; int nohead; char *sort; int showmsg; int ssdiff; int show_all; int context; int ignorews; char *vpath; }; struct cgit_config { char *agefile; char *cache_root; char *clone_prefix; char *clone_url; char *css; char *favicon; char *footer; char *head_include; char *header; char *index_header; char *index_info; char *logo; char *logo_link; char *mimetype_file; char *module_link; char *project_list; struct string_list readme; char *robots; char *root_title; char *root_desc; char *root_readme; char *script_name; char *section; char *repository_sort; char *virtual_root; /* Always ends with '/'. */ char *strict_export; int cache_size; int cache_dynamic_ttl; int cache_max_create_time; int cache_repo_ttl; int cache_root_ttl; int cache_scanrc_ttl; int cache_static_ttl; int cache_about_ttl; int case_sensitive_sort; int embedded; int enable_filter_overrides; int enable_http_clone; int enable_index_links; int enable_index_owner; int enable_commit_graph; int enable_log_filecount; int enable_log_linecount; int enable_remote_branches; int enable_subject_links; int enable_tree_linenumbers; int enable_git_config; int local_time; int max_atom_items; int max_repo_count; int max_commit_count; int max_lock_attempts; int max_msg_len; int max_repodesc_len; int max_blob_size; int max_stats; int nocache; int noplainemail; int noheader; int renamelimit; int remove_suffix; int scan_hidden_path; int section_from_path; int snapshots; int section_sort; int summary_branches; int summary_log; int summary_tags; int ssdiff; int branch_sort; int commit_sort; struct string_list mimetypes; struct cgit_filter *about_filter; struct cgit_filter *commit_filter; struct cgit_filter *source_filter; struct cgit_filter *email_filter; struct cgit_filter *auth_filt