blob: 2b0884f1ef3123f26d9a7b3ba03e3d14ae1ccd57 [file] [log] [blame]
Franck Bui-Huu4df096a2006-09-07 15:12:02 +02001#ifndef ARCHIVE_H
2#define ARCHIVE_H
3
Franck Bui-Huu4df096a2006-09-07 15:12:02 +02004struct archiver_args {
5 const char *base;
René Scharfed53fe812008-07-15 09:49:38 +02006 size_t baselen;
Franck Bui-Huu4df096a2006-09-07 15:12:02 +02007 struct tree *tree;
8 const unsigned char *commit_sha1;
René Scharfe8460b2f2007-09-03 20:07:01 +02009 const struct commit *commit;
Franck Bui-Huu4df096a2006-09-07 15:12:02 +020010 time_t time;
11 const char **pathspec;
Junio C Hamanoe0ffb242006-09-09 22:42:02 -070012 unsigned int verbose : 1;
Nguyễn Thái Ngọc Duyba053ea2009-04-18 00:18:05 +020013 unsigned int worktree_attributes : 1;
René Scharfe3a176c62008-07-18 16:30:32 +020014 int compression_level;
Franck Bui-Huu4df096a2006-09-07 15:12:02 +020015};
16
Jeff King13e0f882011-06-21 21:23:33 -040017#define ARCHIVER_WANT_COMPRESSION_LEVELS 1
Jeff King7b977302011-06-21 23:17:35 -040018#define ARCHIVER_REMOTE 2
Jeff King13e0f882011-06-21 21:23:33 -040019struct archiver {
20 const char *name;
Jeff King4d7c9892011-06-21 21:24:07 -040021 int (*write_archive)(const struct archiver *, struct archiver_args *);
Jeff King13e0f882011-06-21 21:23:33 -040022 unsigned flags;
Jeff King4d7c9892011-06-21 21:24:07 -040023 void *data;
Jeff King13e0f882011-06-21 21:23:33 -040024};
25extern void register_archiver(struct archiver *);
26
27extern void init_tar_archiver(void);
28extern void init_zip_archiver(void);
Franck Bui-Huu4df096a2006-09-07 15:12:02 +020029
René Scharfe562e25a2008-07-14 21:22:24 +020030typedef 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é Scharfe562e25a2008-07-14 21:22:24 +020032extern int write_archive_entries(struct archiver_args *args, write_archive_entry_fn_t write_entry);
Jeff King7b977302011-06-21 23:17:35 -040033extern int write_archive(int argc, const char **argv, const char *prefix, int setup_prefix, const char *name_hint, int remote);
Jeff King56baa612011-06-21 21:24:48 -040034
35const char *archive_format_from_filename(const char *filename);
René Scharfe562e25a2008-07-14 21:22:24 +020036
Franck Bui-Huu4df096a2006-09-07 15:12:02 +020037#endif /* ARCHIVE_H */