Merge branch 'jk/cat-file-batch-optim'
[git/gitweb.git] / archive.h
blob895afcdc7a00c5f9f16a21f2c9fe361a3e218d37
1 #ifndef ARCHIVE_H
2 #define ARCHIVE_H
4 struct archiver_args {
5 const char *base;
6 size_t baselen;
7 struct tree *tree;
8 const unsigned char *commit_sha1;
9 const struct commit *commit;
10 time_t time;
11 const char **pathspec;
12 unsigned int verbose : 1;
13 unsigned int worktree_attributes : 1;
14 unsigned int convert : 1;
15 int compression_level;
18 #define ARCHIVER_WANT_COMPRESSION_LEVELS 1
19 #define ARCHIVER_REMOTE 2
20 struct archiver {
21 const char *name;
22 int (*write_archive)(const struct archiver *, struct archiver_args *);
23 unsigned flags;
24 void *data;
26 extern void register_archiver(struct archiver *);
28 extern void init_tar_archiver(void);
29 extern void init_zip_archiver(void);
31 typedef int (*write_archive_entry_fn_t)(struct archiver_args *args,
32 const unsigned char *sha1,
33 const char *path, size_t pathlen,
34 unsigned int mode);
36 extern int write_archive_entries(struct archiver_args *args, write_archive_entry_fn_t write_entry);
37 extern int write_archive(int argc, const char **argv, const char *prefix, int setup_prefix, const char *name_hint, int remote);
39 const char *archive_format_from_filename(const char *filename);
40 extern void *sha1_file_to_archive(const struct archiver_args *args,
41 const char *path, const unsigned char *sha1,
42 unsigned int mode, enum object_type *type,
43 unsigned long *sizep);
45 #endif /* ARCHIVE_H */