Merge branch 'jk/unused-function'
[git/debian.git] / archive.h
blobd4f97a00f541c66b694ff00340ead218752bf37e
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 *base;
12 size_t baselen;
13 struct tree *tree;
14 const unsigned char *commit_sha1;
15 const struct commit *commit;
16 timestamp_t time;
17 struct pathspec pathspec;
18 unsigned int verbose : 1;
19 unsigned int worktree_attributes : 1;
20 unsigned int convert : 1;
21 int compression_level;
24 /* main api */
26 extern int write_archive(int argc, const char **argv, const char *prefix,
27 struct repository *repo,
28 const char *name_hint, int remote);
30 const char *archive_format_from_filename(const char *filename);
32 /* archive backend stuff */
34 #define ARCHIVER_WANT_COMPRESSION_LEVELS 1
35 #define ARCHIVER_REMOTE 2
36 struct archiver {
37 const char *name;
38 int (*write_archive)(const struct archiver *, struct archiver_args *);
39 unsigned flags;
40 void *data;
42 extern void register_archiver(struct archiver *);
44 extern void init_tar_archiver(void);
45 extern void init_zip_archiver(void);
47 typedef int (*write_archive_entry_fn_t)(struct archiver_args *args,
48 const struct object_id *oid,
49 const char *path, size_t pathlen,
50 unsigned int mode);
52 extern int write_archive_entries(struct archiver_args *args, write_archive_entry_fn_t write_entry);
53 extern void *object_file_to_archive(const struct archiver_args *args,
54 const char *path, const struct object_id *oid,
55 unsigned int mode, enum object_type *type,
56 unsigned long *sizep);
58 #endif /* ARCHIVE_H */