ls-files: convert to use parse_pathspec
[git/git.git] / archive.h
CommitLineData
4df096a5
FBH
1#ifndef ARCHIVE_H
2#define ARCHIVE_H
3
4df096a5
FBH
4struct archiver_args {
5 const char *base;
d53fe818 6 size_t baselen;
4df096a5
FBH
7 struct tree *tree;
8 const unsigned char *commit_sha1;
8460b2fc 9 const struct commit *commit;
4df096a5
FBH
10 time_t time;
11 const char **pathspec;
e0ffb248 12 unsigned int verbose : 1;
ba053ea9 13 unsigned int worktree_attributes : 1;
9cb513b7 14 unsigned int convert : 1;
3a176c6c 15 int compression_level;
4df096a5
FBH
16};
17
13e0f88d 18#define ARCHIVER_WANT_COMPRESSION_LEVELS 1
7b97730b 19#define ARCHIVER_REMOTE 2
13e0f88d
JK
20struct archiver {
21 const char *name;
4d7c9898 22 int (*write_archive)(const struct archiver *, struct archiver_args *);
13e0f88d 23 unsigned flags;
4d7c9898 24 void *data;
13e0f88d
JK
25};
26extern void register_archiver(struct archiver *);
4df096a5 27
13e0f88d
JK
28extern void init_tar_archiver(void);
29extern void init_zip_archiver(void);
562e25ab 30
9cb513b7
NTND
31typedef 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);
4df096a5 35
562e25ab 36extern int write_archive_entries(struct archiver_args *args, write_archive_entry_fn_t write_entry);
7b97730b 37extern int write_archive(int argc, const char **argv, const char *prefix, int setup_prefix, const char *name_hint, int remote);
56baa61d
JK
38
39const char *archive_format_from_filename(const char *filename);
9cb513b7
NTND
40extern 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);
562e25ab 44
4df096a5 45#endif /* ARCHIVE_H */