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; |
René Scharfe | 3a176c6 | 2008-07-18 16:30:32 +0200 | [diff] [blame] | 14 | int compression_level; |
Franck Bui-Huu | 4df096a | 2006-09-07 15:12:02 +0200 | [diff] [blame] | 15 | }; |
| 16 | |
Jeff King | 13e0f88 | 2011-06-21 21:23:33 -0400 | [diff] [blame] | 17 | #define ARCHIVER_WANT_COMPRESSION_LEVELS 1 |
Jeff King | 7b97730 | 2011-06-21 23:17:35 -0400 | [diff] [blame] | 18 | #define ARCHIVER_REMOTE 2 |
Jeff King | 13e0f88 | 2011-06-21 21:23:33 -0400 | [diff] [blame] | 19 | struct archiver { |
| 20 | const char *name; |
Jeff King | 4d7c989 | 2011-06-21 21:24:07 -0400 | [diff] [blame] | 21 | int (*write_archive)(const struct archiver *, struct archiver_args *); |
Jeff King | 13e0f88 | 2011-06-21 21:23:33 -0400 | [diff] [blame] | 22 | unsigned flags; |
Jeff King | 4d7c989 | 2011-06-21 21:24:07 -0400 | [diff] [blame] | 23 | void *data; |
Jeff King | 13e0f88 | 2011-06-21 21:23:33 -0400 | [diff] [blame] | 24 | }; |
| 25 | extern void register_archiver(struct archiver *); |
| 26 | |
| 27 | extern void init_tar_archiver(void); |
| 28 | extern void init_zip_archiver(void); |
Franck Bui-Huu | 4df096a | 2006-09-07 15:12:02 +0200 | [diff] [blame] | 29 | |
René Scharfe | 562e25a | 2008-07-14 21:22:24 +0200 | [diff] [blame] | 30 | typedef int (*write_archive_entry_fn_t)(struct archiver_args *args, const unsigned char *sha1, const char *path, size_t pathlen, unsigned int mode, void *buffer, unsigned long size); |
| 31 | |
René Scharfe | 562e25a | 2008-07-14 21:22:24 +0200 | [diff] [blame] | 32 | 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] | 33 | 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] | 34 | |
| 35 | const char *archive_format_from_filename(const char *filename); |
René Scharfe | 562e25a | 2008-07-14 21:22:24 +0200 | [diff] [blame] | 36 | |
Franck Bui-Huu | 4df096a | 2006-09-07 15:12:02 +0200 | [diff] [blame] | 37 | #endif /* ARCHIVE_H */ |