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