Add missing includes and forward declarations
[git/git.git] / archive.h
1 #ifndef ARCHIVE_H
2 #define ARCHIVE_H
3
4 #include "cache.h"
5 #include "pathspec.h"
6
7 struct archiver_args {
8 const char *base;
9 size_t baselen;
10 struct tree *tree;
11 const unsigned char *commit_sha1;
12 const struct commit *commit;
13 timestamp_t time;
14 struct pathspec pathspec;
15 unsigned int verbose : 1;
16 unsigned int worktree_attributes : 1;
17 unsigned int convert : 1;
18 int compression_level;
19 };
20
21 #define ARCHIVER_WANT_COMPRESSION_LEVELS 1
22 #define ARCHIVER_REMOTE 2
23 struct archiver {
24 const char *name;
25 int (*write_archive)(const struct archiver *, struct archiver_args *);
26 unsigned flags;
27 void *data;
28 };
29 extern void register_archiver(struct archiver *);
30
31 extern void init_tar_archiver(void);
32 extern void init_zip_archiver(void);
33
34 typedef int (*write_archive_entry_fn_t)(struct archiver_args *args,
35 const struct object_id *oid,
36 const char *path, size_t pathlen,
37 unsigned int mode);
38
39 extern int write_archive_entries(struct archiver_args *args, write_archive_entry_fn_t write_entry);
40 extern int write_archive(int argc, const char **argv, const char *prefix, const char *name_hint, int remote);
41
42 const char *archive_format_from_filename(const char *filename);
43 extern void *object_file_to_archive(const struct archiver_args *args,
44 const char *path, const struct object_id *oid,
45 unsigned int mode, enum object_type *type,
46 unsigned long *sizep);
47
48 #endif /* ARCHIVE_H */