]>
Commit | Line | Data |
---|---|---|
1 | #ifndef ARCHIVE_H | |
2 | #define ARCHIVE_H | |
3 | ||
4 | #include "cache.h" | |
5 | #include "pathspec.h" | |
6 | ||
7 | struct repository; | |
8 | struct pretty_print_context; | |
9 | ||
10 | struct archiver_args { | |
11 | struct repository *repo; | |
12 | char *refname; | |
13 | const char *prefix; | |
14 | const char *base; | |
15 | size_t baselen; | |
16 | struct tree *tree; | |
17 | const struct object_id *commit_oid; | |
18 | const struct commit *commit; | |
19 | timestamp_t time; | |
20 | struct pathspec pathspec; | |
21 | unsigned int verbose : 1; | |
22 | unsigned int worktree_attributes : 1; | |
23 | unsigned int convert : 1; | |
24 | int compression_level; | |
25 | struct string_list extra_files; | |
26 | struct pretty_print_context *pretty_ctx; | |
27 | }; | |
28 | ||
29 | /* main api */ | |
30 | ||
31 | int write_archive(int argc, const char **argv, const char *prefix, | |
32 | struct repository *repo, | |
33 | const char *name_hint, int remote); | |
34 | ||
35 | const char *archive_format_from_filename(const char *filename); | |
36 | ||
37 | /* archive backend stuff */ | |
38 | ||
39 | #define ARCHIVER_WANT_COMPRESSION_LEVELS 1 | |
40 | #define ARCHIVER_REMOTE 2 | |
41 | #define ARCHIVER_HIGH_COMPRESSION_LEVELS 4 | |
42 | struct archiver { | |
43 | const char *name; | |
44 | int (*write_archive)(const struct archiver *, struct archiver_args *); | |
45 | unsigned flags; | |
46 | void *data; | |
47 | }; | |
48 | void register_archiver(struct archiver *); | |
49 | ||
50 | void init_tar_archiver(void); | |
51 | void init_zip_archiver(void); | |
52 | void init_archivers(void); | |
53 | ||
54 | typedef int (*write_archive_entry_fn_t)(struct archiver_args *args, | |
55 | const struct object_id *oid, | |
56 | const char *path, size_t pathlen, | |
57 | unsigned int mode, | |
58 | void *buffer, unsigned long size); | |
59 | ||
60 | int write_archive_entries(struct archiver_args *args, write_archive_entry_fn_t write_entry); | |
61 | ||
62 | #endif /* ARCHIVE_H */ |