Franck Bui-Huu | 4df096a | 2006-09-07 15:12:02 +0200 | [diff] [blame] | 1 | #ifndef ARCHIVE_H |
| 2 | #define ARCHIVE_H |
| 3 | |
Franck Bui-Huu | 4df096a | 2006-09-07 15:12:02 +0200 | [diff] [blame] | 4 | struct archiver_args { |
| 5 | const char *base; |
René Scharfe | d53fe81 | 2008-07-15 09:49:38 +0200 | [diff] [blame] | 6 | size_t baselen; |
Franck Bui-Huu | 4df096a | 2006-09-07 15:12:02 +0200 | [diff] [blame] | 7 | struct tree *tree; |
| 8 | const unsigned char *commit_sha1; |
René Scharfe | 8460b2f | 2007-09-03 20:07:01 +0200 | [diff] [blame] | 9 | const struct commit *commit; |
Franck Bui-Huu | 4df096a | 2006-09-07 15:12:02 +0200 | [diff] [blame] | 10 | time_t time; |
| 11 | const char **pathspec; |
Junio C Hamano | e0ffb24 | 2006-09-09 22:42:02 -0700 | [diff] [blame] | 12 | unsigned int verbose : 1; |
Nguyễn Thái Ngọc Duy | ba053ea | 2009-04-18 00:18:05 +0200 | [diff] [blame] | 13 | unsigned int worktree_attributes : 1; |
Nguyễn Thái Ngọc Duy | 9cb513b | 2012-05-03 08:51:03 +0700 | [diff] [blame] | 14 | unsigned int convert : 1; |
René Scharfe | 3a176c6 | 2008-07-18 16:30:32 +0200 | [diff] [blame] | 15 | int compression_level; |
Franck Bui-Huu | 4df096a | 2006-09-07 15:12:02 +0200 | [diff] [blame] | 16 | }; |
| 17 | |
Jeff King | 13e0f88 | 2011-06-21 21:23:33 -0400 | [diff] [blame] | 18 | #define ARCHIVER_WANT_COMPRESSION_LEVELS 1 |
Jeff King | 7b97730 | 2011-06-21 23:17:35 -0400 | [diff] [blame] | 19 | #define ARCHIVER_REMOTE 2 |
Jeff King | 13e0f88 | 2011-06-21 21:23:33 -0400 | [diff] [blame] | 20 | struct archiver { |
| 21 | const char *name; |
Jeff King | 4d7c989 | 2011-06-21 21:24:07 -0400 | [diff] [blame] | 22 | int (*write_archive)(const struct archiver *, struct archiver_args *); |
Jeff King | 13e0f88 | 2011-06-21 21:23:33 -0400 | [diff] [blame] | 23 | unsigned flags; |
Jeff King | 4d7c989 | 2011-06-21 21:24:07 -0400 | [diff] [blame] | 24 | void *data; |
Jeff King | 13e0f88 | 2011-06-21 21:23:33 -0400 | [diff] [blame] | 25 | }; |
| 26 | extern void register_archiver(struct archiver *); |
| 27 | |
| 28 | extern void init_tar_archiver(void); |
| 29 | extern void init_zip_archiver(void); |
Franck Bui-Huu | 4df096a | 2006-09-07 15:12:02 +0200 | [diff] [blame] | 30 | |
Nguyễn Thái Ngọc Duy | 9cb513b | 2012-05-03 08:51:03 +0700 | [diff] [blame] | 31 | typedef int (*write_archive_entry_fn_t)(struct archiver_args *args, |
| 32 | const unsigned char *sha1, |
| 33 | const char *path, size_t pathlen, |
| 34 | unsigned int mode); |
René Scharfe | 562e25a | 2008-07-14 21:22:24 +0200 | [diff] [blame] | 35 | |
René Scharfe | 562e25a | 2008-07-14 21:22:24 +0200 | [diff] [blame] | 36 | extern int write_archive_entries(struct archiver_args *args, write_archive_entry_fn_t write_entry); |
Jeff King | 7b97730 | 2011-06-21 23:17:35 -0400 | [diff] [blame] | 37 | extern int write_archive(int argc, const char **argv, const char *prefix, int setup_prefix, const char *name_hint, int remote); |
Jeff King | 56baa61 | 2011-06-21 21:24:48 -0400 | [diff] [blame] | 38 | |
| 39 | const char *archive_format_from_filename(const char *filename); |
Nguyễn Thái Ngọc Duy | 9cb513b | 2012-05-03 08:51:03 +0700 | [diff] [blame] | 40 | extern void *sha1_file_to_archive(const struct archiver_args *args, |
| 41 | const char *path, const unsigned char *sha1, |
| 42 | unsigned int mode, enum object_type *type, |
| 43 | unsigned long *sizep); |
René Scharfe | 562e25a | 2008-07-14 21:22:24 +0200 | [diff] [blame] | 44 | |
Franck Bui-Huu | 4df096a | 2006-09-07 15:12:02 +0200 | [diff] [blame] | 45 | #endif /* ARCHIVE_H */ |