Merge branch 'maint'
[git/jrn.git] / archive.h
blob4a791e1fed4ecb0fc89b309b294acc93793886f0
1 #ifndef ARCHIVE_H
2 #define ARCHIVE_H
4 #include "pathspec.h"
6 struct archiver_args {
7 const char *base;
8 size_t baselen;
9 struct tree *tree;
10 const unsigned char *commit_sha1;
11 const struct commit *commit;
12 time_t time;
13 struct pathspec pathspec;
14 unsigned int verbose : 1;
15 unsigned int worktree_attributes : 1;
16 unsigned int convert : 1;
17 int compression_level;
20 #define ARCHIVER_WANT_COMPRESSION_LEVELS 1
21 #define ARCHIVER_REMOTE 2
22 struct archiver {
23 const char *name;
24 int (*write_archive)(const struct archiver *, struct archiver_args *);
25 unsigned flags;
26 void *data;
28 extern void register_archiver(struct archiver *);
30 extern void init_tar_archiver(void);
31 extern void init_zip_archiver(void);
33 typedef int (*write_archive_entry_fn_t)(struct archiver_args *args,
34 const unsigned char *sha1,
35 const char *path, size_t pathlen,
36 unsigned int mode);
38 extern int write_archive_entries(struct archiver_args *args, write_archive_entry_fn_t write_entry);
39 extern int write_archive(int argc, const char **argv, const char *prefix, int setup_prefix, const char *name_hint, int remote);
41 const char *archive_format_from_filename(const char *filename);
42 extern void *sha1_file_to_archive(const struct archiver_args *args,
43 const char *path, const unsigned char *sha1,
44 unsigned int mode, enum object_type *type,
45 unsigned long *sizep);
47 #endif /* ARCHIVE_H */