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