archive.hon commit get-tar-commit-id: parse comment record (3548726)
   1#ifndef ARCHIVE_H
   2#define ARCHIVE_H
   3
   4#include "cache.h"
   5#include "pathspec.h"
   6
   7struct repository;
   8
   9struct archiver_args {
  10        struct repository *repo;
  11        const char *base;
  12        size_t baselen;
  13        struct tree *tree;
  14        const unsigned char *commit_sha1;
  15        const struct commit *commit;
  16        timestamp_t time;
  17        struct pathspec pathspec;
  18        unsigned int verbose : 1;
  19        unsigned int worktree_attributes : 1;
  20        unsigned int convert : 1;
  21        int compression_level;
  22};
  23
  24/* main api */
  25
  26extern int write_archive(int argc, const char **argv, const char *prefix,
  27                         struct repository *repo,
  28                         const char *name_hint, int remote);
  29
  30const char *archive_format_from_filename(const char *filename);
  31
  32/* archive backend stuff */
  33
  34#define ARCHIVER_WANT_COMPRESSION_LEVELS 1
  35#define ARCHIVER_REMOTE 2
  36struct archiver {
  37        const char *name;
  38        int (*write_archive)(const struct archiver *, struct archiver_args *);
  39        unsigned flags;
  40        void *data;
  41};
  42extern void register_archiver(struct archiver *);
  43
  44extern void init_tar_archiver(void);
  45extern void init_zip_archiver(void);
  46extern void init_archivers(void);
  47
  48typedef int (*write_archive_entry_fn_t)(struct archiver_args *args,
  49                                        const struct object_id *oid,
  50                                        const char *path, size_t pathlen,
  51                                        unsigned int mode);
  52
  53extern int write_archive_entries(struct archiver_args *args, write_archive_entry_fn_t write_entry);
  54extern void *object_file_to_archive(const struct archiver_args *args,
  55                                    const char *path, const struct object_id *oid,
  56                                    unsigned int mode, enum object_type *type,
  57                                    unsigned long *sizep);
  58
  59#endif  /* ARCHIVE_H */