Merge branch 'js/azure-pipelines-msvc'
[git.git] / archive.h
blobe60e3dd31c79f1c04b7afcae8eb5623238e1234f
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 struct object_id *commit_oid;
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 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 void register_archiver(struct archiver *);
44 void init_tar_archiver(void);
45 void init_zip_archiver(void);
46 void init_archivers(void);
48 typedef int (*write_archive_entry_fn_t)(struct archiver_args *args,
49 const struct object_id *oid,
50 const char *path, size_t pathlen,
51 unsigned int mode);
53 int write_archive_entries(struct archiver_args *args, write_archive_entry_fn_t write_entry);
54 void *object_file_to_archive(const struct archiver_args *args,
55 const char *path, const struct object_id *oid,
56 unsigned int mode, enum object_type *type,
57 unsigned long *sizep);
59 #endif /* ARCHIVE_H */