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 char *path)
15 static struct strbuf buf = STRBUF_INIT;
18 err = fast_export_ls(path, &dummy, &buf);
21 die_errno("BUG: unexpected fast_export_ls error");
27 uint32_t repo_read_mode(const char *path)
31 static struct strbuf dummy = STRBUF_INIT;
34 err = fast_export_ls(path, &result, &dummy);
37 die_errno("BUG: unexpected fast_export_ls error");
38 /* Treat missing paths as directories. */
44 void repo_copy(uint32_t revision, const char *src, const char *dst)
48 static struct strbuf data = STRBUF_INIT;
51 err = fast_export_ls_rev(revision, src, &mode, &data);
54 die_errno("BUG: unexpected fast_export_ls_rev error");
55 fast_export_delete(dst);
58 fast_export_modify(dst, mode, data.buf);
61 void repo_delete(const char *path)
63 fast_export_delete(path);