SubmittingPatches: clarify GitHub artifact format
[git.git] / archive.h
blob3a4bdfbd078109680dd54143d03ee2567a0cba31
1 #ifndef ARCHIVE_H
2 #define ARCHIVE_H
4 #include "object-name.h"
5 #include "pathspec.h"
6 #include "string-list.h"
8 struct repository;
9 struct pretty_print_context;
11 struct archiver_args {
12 struct repository *repo;
13 char *refname;
14 const char *prefix;
15 const char *base;
16 size_t baselen;
17 struct tree *tree;
18 const struct object_id *commit_oid;
19 const struct commit *commit;
20 const char *mtime_option;
21 timestamp_t time;
22 struct pathspec pathspec;
23 unsigned int verbose : 1;
24 unsigned int worktree_attributes : 1;
25 unsigned int convert : 1;
26 int compression_level;
27 struct string_list extra_files;
28 struct pretty_print_context *pretty_ctx;
31 /* main api */
33 int write_archive(int argc, const char **argv, const char *prefix,
34 struct repository *repo,
35 const char *name_hint, int remote);
37 const char *archive_format_from_filename(const char *filename);
39 /* archive backend stuff */
41 #define ARCHIVER_WANT_COMPRESSION_LEVELS 1
42 #define ARCHIVER_REMOTE 2
43 #define ARCHIVER_HIGH_COMPRESSION_LEVELS 4
44 struct archiver {
45 const char *name;
46 int (*write_archive)(const struct archiver *, struct archiver_args *);
47 unsigned flags;
48 char *filter_command;
50 void register_archiver(struct archiver *);
52 void init_tar_archiver(void);
53 void init_zip_archiver(void);
54 void init_archivers(void);
56 typedef int (*write_archive_entry_fn_t)(struct archiver_args *args,
57 const struct object_id *oid,
58 const char *path, size_t pathlen,
59 unsigned int mode,
60 void *buffer, unsigned long size);
62 int write_archive_entries(struct archiver_args *args, write_archive_entry_fn_t write_entry);
64 #endif /* ARCHIVE_H */