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