at commit 52e324c8

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
8 struct 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 }
22 void bundle_header_init(struct bundle_header *header);
23 void bundle_header_release(struct bundle_header *header);
24
25 int is_bundle(const char *path, int quiet);
26 int read_bundle_header(const char *path, struct bundle_header *header);
27 int read_bundle_header_fd(int fd, struct bundle_header *header,
28 const char *report_path);
29 int create_bundle(struct repository *r, const char *path,
30 int argc, const char **argv, int version, int progress);
31
32 enum verify_bundle_flags {
33 VERIFY_BUNDLE_VERBOSE = (1 << 0),
34 VERIFY_BUNDLE_QUIET = (1 << 1),
35 VERIFY_BUNDLE_FSCK = (1 << 2),
36 };
37
38 int verify_bundle(struct repository *r, struct bundle_header *header,
39 enum verify_bundle_flags flags);
40
41 struct unbundle_opts {
42 enum verify_bundle_flags flags;
43 /*
44 * fsck_msg_types may optionally contain fsck message severity
45 * configuration. If present, this configuration gets directly appended
46 * to a '--fsck-objects' option and therefore must be prefixed with '='.
47 * (E.g. "=missingEmail=ignore,gitmodulesUrl=ignore")
48 */
49 const char *fsck_msg_types;
50 };
51
52 /**
53 * Unbundle after reading the header with read_bundle_header().
54 *
55 * We'll invoke "git index-pack --stdin --fix-thin" for you on the
56 * provided `bundle_fd` from read_bundle_header().
57 *
58 * Provide "extra_index_pack_args" to pass any extra arguments
59 * (e.g. "-v" for verbose/progress), NULL otherwise. The provided
60 * "extra_index_pack_args" (if any) will be strvec_clear()'d for you.
61 *
62 * Before unbundling, this method will call verify_bundle() with 'flags'
63 * provided in 'opts'.
64 *
65 * Note that the `bundle_fd` will be closed as part of the operation.
66 */
67 int unbundle(struct repository *r, struct bundle_header *header,
68 int bundle_fd, struct strvec *extra_index_pack_args,
69 struct unbundle_opts *opts);
70 int list_bundle_refs(struct bundle_header *header,
71 int argc, const char **argv);
72
73 #endif