]> gitweb.ps.run Git - ps-cgit/blobdiff - ui-snapshot.c
global: use proper accessors for maybe_tree
[ps-cgit] / ui-snapshot.c
index 85efe64a0e7f6f41bedbddfe6722fb4db5a6832a..556d3ed4125aac62a6d307d10b8869cc544d6118 100644 (file)
@@ -79,18 +79,32 @@ static int write_tar_bzip2_archive(const char *hex, const char *prefix)
        return write_compressed_tar_archive(hex, prefix, argv);
 }
 
+static int write_tar_lzip_archive(const char *hex, const char *prefix)
+{
+       char *argv[] = { "lzip", NULL };
+       return write_compressed_tar_archive(hex, prefix, argv);
+}
+
 static int write_tar_xz_archive(const char *hex, const char *prefix)
 {
        char *argv[] = { "xz", NULL };
        return write_compressed_tar_archive(hex, prefix, argv);
 }
 
+static int write_tar_zstd_archive(const char *hex, const char *prefix)
+{
+       char *argv[] = { "zstd", "-T0", NULL };
+       return write_compressed_tar_archive(hex, prefix, argv);
+}
+
 const struct cgit_snapshot_format cgit_snapshot_formats[] = {
        /* .tar must remain the 0 index */
        { ".tar",       "application/x-tar",    write_tar_archive       },
        { ".tar.gz",    "application/x-gzip",   write_tar_gzip_archive  },
        { ".tar.bz2",   "application/x-bzip2",  write_tar_bzip2_archive },
+       { ".tar.lz",    "application/x-lzip",   write_tar_lzip_archive  },
        { ".tar.xz",    "application/x-xz",     write_tar_xz_archive    },
+       { ".tar.zst",   "application/x-zstd",   write_tar_zstd_archive  },
        { ".zip",       "application/x-zip",    write_zip_archive       },
        { NULL }
 };
@@ -156,6 +170,7 @@ static int make_snapshot(const struct cgit_snapshot_format *format,
        ctx.page.mimetype = xstrdup(format->mimetype);
        ctx.page.filename = xstrdup(filename);
        cgit_print_http_headers();
+       init_archivers();
        format->write_func(hex, prefix);
        return 0;
 }