Signed-off-by: David Barr <david.barr@xxxxxxxxxxxx> Signed-off-by: Jonathan Nieder <jrnieder@xxxxxxxxx> Signed-off-by: David Barr <david.barr@xxxxxxxxxxxx> --- vcs-svn/repo_tree.c | 24 ++++-------------------- vcs-svn/repo_tree.h | 3 +-- vcs-svn/svndump.c | 3 +-- 3 files changed, 6 insertions(+), 24 deletions(-) diff --git a/vcs-svn/repo_tree.c b/vcs-svn/repo_tree.c index f2466bc..67d27f0 100644 --- a/vcs-svn/repo_tree.c +++ b/vcs-svn/repo_tree.c @@ -8,39 +8,23 @@ #include "repo_tree.h" #include "fast_export.h" -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(path, &dummy, &buf); + err = fast_export_ls(path, mode_out, &buf); if (err) { if (errno != ENOENT) die_errno("BUG: unexpected fast_export_ls error"); + /* Treat missing paths as directories. */ + *mode_out = REPO_MODE_DIR; return NULL; } return buf.buf; } -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; diff --git a/vcs-svn/repo_tree.h b/vcs-svn/repo_tree.h index af2415c..eb003e6 100644 --- a/vcs-svn/repo_tree.h +++ b/vcs-svn/repo_tree.h @@ -11,8 +11,7 @@ uint32_t next_blob_mark(void); 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, uint32_t author, char *log, uint32_t uuid, uint32_t url, long unsigned timestamp); diff --git a/vcs-svn/svndump.c b/vcs-svn/svndump.c index afdfc63..15b173e 100644 --- a/vcs-svn/svndump.c +++ b/vcs-svn/svndump.c @@ -236,8 +236,7 @@ static void handle_node(void) old_data = NULL; } else if (node_ctx.action == NODEACT_CHANGE) { uint32_t 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) -- 1.7.3.2.846.gf4b062 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html