🌐 AI搜索 & 代理 主页
blob: 021adbdcbb3d9b482a08b304a80e62264e1a3630 [file] [log] [blame]
Johannes Schindelin30415d52007-09-11 03:03:151#ifndef BUNDLE_H
2#define BUNDLE_H
3
Jeff Kingdbbcd442020-07-28 20:23:394#include "strvec.h"
Ævar Arnfjörð Bjarmason10b635b2021-07-02 09:57:325#include "string-list.h"
Derrick Stolee105c6f12022-03-09 16:01:396#include "list-objects-filter-options.h"
Johannes Schindelin30415d52007-09-11 03:03:157
8struct bundle_header {
brian m. carlsonc5aecfc2020-07-29 23:14:209 unsigned version;
Ævar Arnfjörð Bjarmason10b635b2021-07-02 09:57:3210 struct string_list prerequisites;
11 struct string_list references;
brian m. carlson6161ce72020-06-19 17:56:0012 const struct git_hash_algo *hash_algo;
Derrick Stolee105c6f12022-03-09 16:01:3913 struct list_objects_filter_options filter;
Johannes Schindelin30415d52007-09-11 03:03:1514};
15
Ævar Arnfjörð Bjarmason10b635b2021-07-02 09:57:3216#define BUNDLE_HEADER_INIT \
17{ \
18 .prerequisites = STRING_LIST_INIT_DUP, \
19 .references = STRING_LIST_INIT_DUP, \
Jeff King2a01bde2022-09-11 05:03:0720 .filter = LIST_OBJECTS_FILTER_INIT, \
Ævar Arnfjörð Bjarmason10b635b2021-07-02 09:57:3221}
22void bundle_header_init(struct bundle_header *header);
23void bundle_header_release(struct bundle_header *header);
24
Junio C Hamano2727b712011-10-13 22:19:3125int is_bundle(const char *path, int quiet);
Johannes Schindelin30415d52007-09-11 03:03:1526int read_bundle_header(const char *path, struct bundle_header *header);
Ævar Arnfjörð Bjarmason89c6e452022-05-16 20:11:0527int read_bundle_header_fd(int fd, struct bundle_header *header,
28 const char *report_path);
Jeff Kingfcb133e2019-01-24 13:11:5129int create_bundle(struct repository *r, const char *path,
Junio C Hamanoe0ad9572020-08-12 01:04:1130 int argc, const char **argv, struct strvec *pack_options,
brian m. carlsonc5aecfc2020-07-29 23:14:2031 int version);
Derrick Stolee89bd7fe2022-10-12 12:52:3732
33enum verify_bundle_flags {
34 VERIFY_BUNDLE_VERBOSE = (1 << 0),
Derrick Stolee70334fc2022-10-12 12:52:3835 VERIFY_BUNDLE_QUIET = (1 << 1),
Derrick Stolee89bd7fe2022-10-12 12:52:3736};
37
38int verify_bundle(struct repository *r, struct bundle_header *header,
39 enum verify_bundle_flags flags);
Ævar Arnfjörð Bjarmason08342572021-08-26 14:05:4740
41/**
42 * Unbundle after reading the header with read_bundle_header().
43 *
44 * We'll invoke "git index-pack --stdin --fix-thin" for you on the
45 * provided `bundle_fd` from read_bundle_header().
Ævar Arnfjörð Bjarmason73660962021-09-05 07:34:4346 *
47 * Provide "extra_index_pack_args" to pass any extra arguments
48 * (e.g. "-v" for verbose/progress), NULL otherwise. The provided
49 * "extra_index_pack_args" (if any) will be strvec_clear()'d for you.
Derrick Stolee89bd7fe2022-10-12 12:52:3750 *
51 * Before unbundling, this method will call verify_bundle() with the
52 * given 'flags'.
Ævar Arnfjörð Bjarmason08342572021-08-26 14:05:4753 */
Nguyễn Thái Ngọc Duy74ae4b62018-11-10 05:49:0154int unbundle(struct repository *r, struct bundle_header *header,
Derrick Stolee89bd7fe2022-10-12 12:52:3755 int bundle_fd, struct strvec *extra_index_pack_args,
56 enum verify_bundle_flags flags);
Johannes Schindelin30415d52007-09-11 03:03:1557int list_bundle_refs(struct bundle_header *header,
58 int argc, const char **argv);
59
60#endif