Git fork
at reftables-rust 74 lines 2.4 kB view raw
1#ifndef BUNDLE_H 2#define BUNDLE_H 3 4#include "strvec.h" 5#include "string-list.h" 6#include "list-objects-filter-options.h" 7 8struct bundle_header { 9 unsigned version; 10 struct string_list prerequisites; 11 struct string_list references; 12 const struct git_hash_algo *hash_algo; 13 struct list_objects_filter_options filter; 14}; 15 16#define BUNDLE_HEADER_INIT \ 17{ \ 18 .prerequisites = STRING_LIST_INIT_DUP, \ 19 .references = STRING_LIST_INIT_DUP, \ 20 .filter = LIST_OBJECTS_FILTER_INIT, \ 21} 22void bundle_header_init(struct bundle_header *header); 23void bundle_header_release(struct bundle_header *header); 24 25int is_bundle(const char *path, int quiet); 26int read_bundle_header(const char *path, struct bundle_header *header); 27int read_bundle_header_fd(int fd, struct bundle_header *header, 28 const char *report_path); 29int create_bundle(struct repository *r, const char *path, 30 int argc, const char **argv, struct strvec *pack_options, 31 int version); 32 33enum verify_bundle_flags { 34 VERIFY_BUNDLE_VERBOSE = (1 << 0), 35 VERIFY_BUNDLE_QUIET = (1 << 1), 36 VERIFY_BUNDLE_FSCK = (1 << 2), 37}; 38 39int verify_bundle(struct repository *r, struct bundle_header *header, 40 enum verify_bundle_flags flags); 41 42struct unbundle_opts { 43 enum verify_bundle_flags flags; 44 /* 45 * fsck_msg_types may optionally contain fsck message severity 46 * configuration. If present, this configuration gets directly appended 47 * to a '--fsck-objects' option and therefore must be prefixed with '='. 48 * (E.g. "=missingEmail=ignore,gitmodulesUrl=ignore") 49 */ 50 const char *fsck_msg_types; 51}; 52 53/** 54 * Unbundle after reading the header with read_bundle_header(). 55 * 56 * We'll invoke "git index-pack --stdin --fix-thin" for you on the 57 * provided `bundle_fd` from read_bundle_header(). 58 * 59 * Provide "extra_index_pack_args" to pass any extra arguments 60 * (e.g. "-v" for verbose/progress), NULL otherwise. The provided 61 * "extra_index_pack_args" (if any) will be strvec_clear()'d for you. 62 * 63 * Before unbundling, this method will call verify_bundle() with 'flags' 64 * provided in 'opts'. 65 * 66 * Note that the `bundle_fd` will be closed as part of the operation. 67 */ 68int unbundle(struct repository *r, struct bundle_header *header, 69 int bundle_fd, struct strvec *extra_index_pack_args, 70 struct unbundle_opts *opts); 71int list_bundle_refs(struct bundle_header *header, 72 int argc, const char **argv); 73 74#endif