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