builtin/stash: fix leak in `show_stash()`
[git/gitster.git] / bundle.h
blob021adbdcbb3d9b482a08b304a80e62264e1a3630
1 #ifndef BUNDLE_H
2 #define BUNDLE_H
4 #include "strvec.h"
5 #include "string-list.h"
6 #include "list-objects-filter-options.h"
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;
16 #define BUNDLE_HEADER_INIT \
17 { \
18 .prerequisites = STRING_LIST_INIT_DUP, \
19 .references = STRING_LIST_INIT_DUP, \
20 .filter = LIST_OBJECTS_FILTER_INIT, \
22 void bundle_header_init(struct bundle_header *header);
23 void bundle_header_release(struct bundle_header *header);
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, struct strvec *pack_options,
31 int version);
33 enum verify_bundle_flags {
34 VERIFY_BUNDLE_VERBOSE = (1 << 0),
35 VERIFY_BUNDLE_QUIET = (1 << 1),
38 int verify_bundle(struct repository *r, struct bundle_header *header,
39 enum verify_bundle_flags flags);
41 /**
42 * Unbundle after reading the header with read_bundle_header().
44 * We'll invoke "git index-pack --stdin --fix-thin" for you on the
45 * provided `bundle_fd` from read_bundle_header().
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.
51 * Before unbundling, this method will call verify_bundle() with the
52 * given 'flags'.
54 int unbundle(struct repository *r, struct bundle_header *header,
55 int bundle_fd, struct strvec *extra_index_pack_args,
56 enum verify_bundle_flags flags);
57 int list_bundle_refs(struct bundle_header *header,
58 int argc, const char **argv);
60 #endif