]> git.ipfire.org Git - thirdparty/git.git/blame - archive.h
The sixth batch
[thirdparty/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
b612ee20
NTND
7struct repository;
8
4df096a5 9struct archiver_args {
b612ee20 10 struct repository *repo;
c397aac0 11 const char *refname;
4df096a5 12 const char *base;
d53fe818 13 size_t baselen;
4df096a5 14 struct tree *tree;
bbf05cf7 15 const struct object_id *commit_oid;
8460b2fc 16 const struct commit *commit;
dddbad72 17 timestamp_t time;
f3e743a0 18 struct pathspec pathspec;
e0ffb248 19 unsigned int verbose : 1;
ba053ea9 20 unsigned int worktree_attributes : 1;
9cb513b7 21 unsigned int convert : 1;
3a176c6c 22 int compression_level;
4df096a5
FBH
23};
24
b612ee20
NTND
25/* main api */
26
55454427 27int write_archive(int argc, const char **argv, const char *prefix,
ad6dad09
DL
28 struct repository *repo,
29 const char *name_hint, int remote);
b612ee20
NTND
30
31const char *archive_format_from_filename(const char *filename);
32
33/* archive backend stuff */
34
13e0f88d 35#define ARCHIVER_WANT_COMPRESSION_LEVELS 1
7b97730b 36#define ARCHIVER_REMOTE 2
13e0f88d
JK
37struct archiver {
38 const char *name;
4d7c9898 39 int (*write_archive)(const struct archiver *, struct archiver_args *);
13e0f88d 40 unsigned flags;
4d7c9898 41 void *data;
13e0f88d 42};
55454427 43void register_archiver(struct archiver *);
4df096a5 44
55454427
DL
45void init_tar_archiver(void);
46void init_zip_archiver(void);
47void init_archivers(void);
562e25ab 48
9cb513b7 49typedef int (*write_archive_entry_fn_t)(struct archiver_args *args,
015ff4f8 50 const struct object_id *oid,
9cb513b7
NTND
51 const char *path, size_t pathlen,
52 unsigned int mode);
4df096a5 53
55454427
DL
54int write_archive_entries(struct archiver_args *args, write_archive_entry_fn_t write_entry);
55void *object_file_to_archive(const struct archiver_args *args,
ad6dad09
DL
56 const char *path, const struct object_id *oid,
57 unsigned int mode, enum object_type *type,
58 unsigned long *sizep);
562e25ab 59
4df096a5 60#endif /* ARCHIVE_H */