diff options
| author | Bryce Kwon <bryce@brycekwon.com> | |
|---|---|---|
| committer | Bryce Kwon <bryce@brycekwon.com> | |
| commit | ||
| parent | ||
| tree | ||
| download | ||
Restyle the sources and fix the audit's findings
Diffstat (limited to 'source/ui-snapshot.h')
| -rw-r--r-- | source/ui-snapshot.h | 40 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1 file changed, 37 insertions, 3 deletions
diff --git a/source/ui-snapshot.h b/source/ui-snapshot.h index a8deec3..9f1ec02 100644 --- a/source/ui-snapshot.h +++ b/source/ui-snapshot.h @@ -1,7 +1,41 @@ -#ifndef UI_SNAPSHOT_H -#define UI_SNAPSHOT_H +/* + * 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 /* UI_SNAPSHOT_H */ +#endif // CGIT_UI_SNAPSHOT_H |
