archive: make zip compression level independent from core git
[git/git.git] / archive.h
CommitLineData
4df096a5
FBH
1#ifndef ARCHIVE_H
2#define ARCHIVE_H
3
4#define MAX_EXTRA_ARGS 32
5#define MAX_ARGS (MAX_EXTRA_ARGS + 32)
6
7struct archiver_args {
8 const char *base;
d53fe818 9 size_t baselen;
4df096a5
FBH
10 struct tree *tree;
11 const unsigned char *commit_sha1;
8460b2fc 12 const struct commit *commit;
4df096a5
FBH
13 time_t time;
14 const char **pathspec;
e0ffb248 15 unsigned int verbose : 1;
3a176c6c 16 int compression_level;
4df096a5
FBH
17};
18
19typedef int (*write_archive_fn_t)(struct archiver_args *);
20
562e25ab
RS
21typedef int (*write_archive_entry_fn_t)(struct archiver_args *args, const unsigned char *sha1, const char *path, size_t pathlen, unsigned int mode, void *buffer, unsigned long size);
22
4df096a5
FBH
23struct archiver {
24 const char *name;
4df096a5 25 write_archive_fn_t write_archive;
489e351e 26 unsigned int flags;
4df096a5
FBH
27};
28
34533004 29extern int parse_archive_args(int argc, const char **argv, const struct archiver **ar, struct archiver_args *args);
4df096a5
FBH
30
31extern void parse_treeish_arg(const char **treeish,
32 struct archiver_args *ar_args,
33 const char *prefix);
34
35extern void parse_pathspec_arg(const char **pathspec,
36 struct archiver_args *args);
efd8696c
FBH
37/*
38 * Archive-format specific backends.
39 */
40extern int write_tar_archive(struct archiver_args *);
ec06bff5 41extern int write_zip_archive(struct archiver_args *);
4df096a5 42
562e25ab
RS
43extern int write_archive_entries(struct archiver_args *args, write_archive_entry_fn_t write_entry);
44
4df096a5 45#endif /* ARCHIVE_H */