Add missing includes and forward declarations
[git/git.git] / archive.h
CommitLineData
4df096a5
FBH
1#ifndef ARCHIVE_H
2#define ARCHIVE_H
3
ef3ca954 4#include "cache.h"
f3e743a0
NTND
5#include "pathspec.h"
6
4df096a5
FBH
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;
dddbad72 13 timestamp_t time;
f3e743a0 14 struct pathspec pathspec;
e0ffb248 15 unsigned int verbose : 1;
ba053ea9 16 unsigned int worktree_attributes : 1;
9cb513b7 17 unsigned int convert : 1;
3a176c6c 18 int compression_level;
4df096a5
FBH
19};
20
13e0f88d 21#define ARCHIVER_WANT_COMPRESSION_LEVELS 1
7b97730b 22#define ARCHIVER_REMOTE 2
13e0f88d
JK
23struct archiver {
24 const char *name;
4d7c9898 25 int (*write_archive)(const struct archiver *, struct archiver_args *);
13e0f88d 26 unsigned flags;
4d7c9898 27 void *data;
13e0f88d
JK
28};
29extern void register_archiver(struct archiver *);
4df096a5 30
13e0f88d
JK
31extern void init_tar_archiver(void);
32extern void init_zip_archiver(void);
562e25ab 33
9cb513b7 34typedef int (*write_archive_entry_fn_t)(struct archiver_args *args,
015ff4f8 35 const struct object_id *oid,
9cb513b7
NTND
36 const char *path, size_t pathlen,
37 unsigned int mode);
4df096a5 38
562e25ab 39extern int write_archive_entries(struct archiver_args *args, write_archive_entry_fn_t write_entry);
eb0224c6 40extern int write_archive(int argc, const char **argv, const char *prefix, const char *name_hint, int remote);
56baa61d
JK
41
42const char *archive_format_from_filename(const char *filename);
e5ec981a 43extern void *object_file_to_archive(const struct archiver_args *args,
44 const char *path, const struct object_id *oid,
45 unsigned int mode, enum object_type *type,
46 unsigned long *sizep);
562e25ab 47
4df096a5 48#endif /* ARCHIVE_H */