Merge branch 'jk/test-cleanup'
[git.git] / archive.h
blob3bd96bf6bba7ecaacb6b50e1f02080f95d11f17c
1 #ifndef ARCHIVE_H
2 #define ARCHIVE_H
4 #include "cache.h"
5 #include "pathspec.h"
7 struct repository;
9 struct archiver_args {
10 struct repository *repo;
11 const char *refname;
12 const char *base;
13 size_t baselen;
14 struct tree *tree;
15 const struct object_id *commit_oid;
16 const struct commit *commit;
17 timestamp_t time;
18 struct pathspec pathspec;
19 unsigned int verbose : 1;
20 unsigned int worktree_attributes : 1;
21 unsigned int convert : 1;
22 int compression_level;
25 /* main api */
27 int write_archive(int argc, const char **argv, const char *prefix,
28 struct repository *repo,
29 const char *name_hint, int remote);
31 const char *archive_format_from_filename(const char *filename);
33 /* archive backend stuff */
35 #define ARCHIVER_WANT_COMPRESSION_LEVELS 1
36 #define ARCHIVER_REMOTE 2
37 struct archiver {
38 const char *name;
39 int (*write_archive)(const struct archiver *, struct archiver_args *);
40 unsigned flags;
41 void *data;
43 void register_archiver(struct archiver *);
45 void init_tar_archiver(void);
46 void init_zip_archiver(void);
47 void init_archivers(void);
49 typedef int (*write_archive_entry_fn_t)(struct archiver_args *args,
50 const struct object_id *oid,
51 const char *path, size_t pathlen,
52 unsigned int mode);
54 int write_archive_entries(struct archiver_args *args, write_archive_entry_fn_t write_entry);
55 void *object_file_to_archive(const struct archiver_args *args,
56 const char *path, const struct object_id *oid,
57 unsigned int mode, enum object_type *type,
58 unsigned long *sizep);
60 #endif /* ARCHIVE_H */