/* * The snapshot page, which serves a commit as a downloadable archive. It owns * the table of formats cgit knows how to write, so the config reader and the * link builders both reach through here to ask which formats a repository * offers. Each format has a bit in the per-repository snapshots mask, taken * from its position in that table. */ #ifndef CGIT_UI_SNAPSHOT_H #define CGIT_UI_SNAPSHOT_H #include "cgit.h" typedef int (*write_archive_fn_t)(const char *hex, const char *prefix); struct cgit_snapshot_format { const char *suffix; const char *mimetype; write_archive_fn_t write_func; }; // Terminated by an entry with a NULL suffix. extern const struct cgit_snapshot_format cgit_snapshot_formats[]; extern unsigned cgit_snapshot_format_bit(const struct cgit_snapshot_format *f); /* * Turn a cgitrc snapshots value into a mask over cgit_snapshot_formats. A * plain number is the legacy form meaning every format, as is the word all, * otherwise the value is a space separated list of suffixes. */ extern int cgit_parse_snapshots_mask(const char *str); // The detached signature stored for this format under refs/notes, if any. extern const struct object_id *cgit_snapshot_get_sig( const char *ref, const struct cgit_snapshot_format *f); extern void cgit_print_snapshot(const char *head, const char *hex, const char *filename, int dwim); #endif // CGIT_UI_SNAPSHOT_H