void fast_export_deinit(void);
void fast_export_reset(void);
- void fast_export_delete(uint32_t depth, const uint32_t *path);
- void fast_export_modify(uint32_t depth, const uint32_t *path,
- uint32_t mode, const char *dataref);
+ void fast_export_delete(const char *path);
+ void fast_export_modify(const char *path, uint32_t mode, const char *dataref);
-void fast_export_begin_commit(uint32_t revision, const char *author, char *log,
- const char *uuid, const char *url,
- unsigned long timestamp);
+void fast_export_begin_commit(uint32_t revision, const char *author,
+ const struct strbuf *log, const char *uuid,
+ const char *url, unsigned long timestamp);
void fast_export_end_commit(uint32_t revision);
void fast_export_data(uint32_t mode, uint32_t len, struct line_buffer *input);
#include "repo_tree.h"
#include "fast_export.h"
- const char *repo_read_path(const uint32_t *path, uint32_t *mode_out)
-const char *repo_read_path(const char *path)
++const char *repo_read_path(const char *path, uint32_t *mode_out)
{
int err;
- uint32_t dummy;
static struct strbuf buf = STRBUF_INIT;
strbuf_reset(&buf);
- err = fast_export_ls(REPO_MAX_PATH_DEPTH, path, mode_out, &buf);
- err = fast_export_ls(path, &dummy, &buf);
++ err = fast_export_ls(path, mode_out, &buf);
if (err) {
if (errno != ENOENT)
die_errno("BUG: unexpected fast_export_ls error");
return buf.buf;
}
- void repo_copy(uint32_t revision, const uint32_t *src, const uint32_t *dst)
-uint32_t repo_read_mode(const char *path)
-{
- int err;
- uint32_t result;
- static struct strbuf dummy = STRBUF_INIT;
-
- strbuf_reset(&dummy);
- err = fast_export_ls(path, &result, &dummy);
- if (err) {
- if (errno != ENOENT)
- die_errno("BUG: unexpected fast_export_ls error");
- /* Treat missing paths as directories. */
- return REPO_MODE_DIR;
- }
- return result;
-}
-
+ void repo_copy(uint32_t revision, const char *src, const char *dst)
{
int err;
uint32_t mode;
#define REPO_MODE_EXE 0100755
#define REPO_MODE_LNK 0120000
- #define REPO_MAX_PATH_LEN 4096
- #define REPO_MAX_PATH_DEPTH 1000
-
uint32_t next_blob_mark(void);
- void repo_copy(uint32_t revision, const uint32_t *src, const uint32_t *dst);
- void repo_add(uint32_t *path, uint32_t mode, uint32_t blob_mark);
- const char *repo_read_path(const uint32_t *path, uint32_t *mode_out);
- void repo_delete(uint32_t *path);
+ void repo_copy(uint32_t revision, const char *src, const char *dst);
+ void repo_add(const char *path, uint32_t mode, uint32_t blob_mark);
-const char *repo_read_path(const char *path);
-uint32_t repo_read_mode(const char *path);
++const char *repo_read_path(const char *path, uint32_t *mode_out);
+ void repo_delete(const char *path);
void repo_commit(uint32_t revision, const char *author,
- char *log, const char *uuid, const char *url,
+ const struct strbuf *log, const char *uuid, const char *url,
long unsigned timestamp);
void repo_diff(uint32_t r1, uint32_t r2);
void repo_init(void);
#include "repo_tree.h"
#include "fast_export.h"
#include "line_buffer.h"
- #include "string_pool.h"
#include "strbuf.h"
-#define REPORT_FILENO 3
-
/*
* Compare start of string to literal of equal length;
* must be guarded by length test.
if (have_text || have_props || node_ctx.srcRev)
die("invalid dump: deletion node has "
"copyfrom info, text, or properties");
- repo_delete(node_ctx.dst);
- return repo_delete(node_ctx.dst.buf);
++ repo_delete(node_ctx.dst.buf);
+ return;
}
if (node_ctx.action == NODEACT_REPLACE) {
- repo_delete(node_ctx.dst);
+ repo_delete(node_ctx.dst.buf);
node_ctx.action = NODEACT_ADD;
}
if (node_ctx.srcRev) {
old_data = NULL;
} else if (node_ctx.action == NODEACT_CHANGE) {
uint32_t mode;
- old_data = repo_read_path(node_ctx.dst, &mode);
- old_data = repo_read_path(node_ctx.dst.buf);
- mode = repo_read_mode(node_ctx.dst.buf);
++ old_data = repo_read_path(node_ctx.dst.buf, &mode);
if (mode == REPO_MODE_DIR && type != REPO_MODE_DIR)
die("invalid dump: cannot modify a directory into a file");
if (mode != REPO_MODE_DIR && type == REPO_MODE_DIR)