/* * 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" struct cgit_snapshot_format { const char *suffix; const char *mimetype; const char *format_arg; // The command line git's output is piped through, or NULL when the // archive goes out as git writes it. const char **compressor; }; // 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 non-zero number is the legacy boolean form and enables plain tar * alone, the word all enables every format, and otherwise the value is a * space separated list of suffixes. */ extern int cgit_parse_snapshots_mask(const char *str); // The suffix that names a signature after the archive it signs. #define SIG_SUFFIX ".asc" /* * 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