2 * Licensed under a two-clause BSD-style license.
3 * See LICENSE for details.
6 #include "git-compat-util.h"
9 #include "fast_export.h"
11 const char *repo_read_path(const uint32_t *path, uint32_t *mode_out)
14 static struct strbuf buf = STRBUF_INIT;
17 err = fast_export_ls(REPO_MAX_PATH_DEPTH, path, mode_out, &buf);
20 die_errno("BUG: unexpected fast_export_ls error");
21 /* Treat missing paths as directories. */
22 *mode_out = REPO_MODE_DIR;
28 void repo_copy(uint32_t revision, const uint32_t *src, const uint32_t *dst)
32 static struct strbuf data = STRBUF_INIT;
35 err = fast_export_ls_rev(revision, REPO_MAX_PATH_DEPTH, src, &mode, &data);
38 die_errno("BUG: unexpected fast_export_ls_rev error");
39 fast_export_delete(REPO_MAX_PATH_DEPTH, dst);
42 fast_export_modify(REPO_MAX_PATH_DEPTH, dst, mode, data.buf);
45 void repo_delete(uint32_t *path)
47 fast_export_delete(REPO_MAX_PATH_DEPTH, path);