{"thread":{"id":"46656","subject":"[PATCH 0/4] vcs-svn: remove repo_tree library","startedAt":"2017-08-22T23:37:40Z","lastAt":"2017-08-23T00:04:55Z","messageCount":11,"participants":["Jonathan Nieder","Stefan Beller"],"isPatch":true,"patchVersion":1,"patchTotal":4},"messages":[{"id":"326994","messageId":"20170822233732.GX13924@aiede.mtv.corp.google.com","threadId":"46656","inReplyTo":null,"subject":"[PATCH 0/4] vcs-svn: remove repo_tree library","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2017-08-22T23:37:32Z","receivedAt":"2017-08-22T23:37:40Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Hi,\n\nStefan noticed that repo_init from vcs-svn/repo_tree.h conflicts with\nrepository.h[1].  Earlier brian m. carlson noticed the same thing[2].\n\nOriginally repo_tree.h was used to manage an in-memory representation\nof the state of the svn tree being imported.  When that in-memory\nrepresentation was retired, we were lazy and left some utility\nfunctions there.  Here is a patch series to finish cleaning up and\nremove vcs-svn/repo_tree.h completely.\n\nThis is an alternative to bc/vcs-svn-cleanup from 'next'.  Those\npatches weren't cc-ed to me and I missed them --- sorry about that.  I\ncan rebase on top of them if that is more convenient.\n\nThoughts of all kinds welcome, as always.\n\nThanks,\nJonathan\n\nJonathan Nieder (4):\n  vcs-svn: remove prototypes for missing functions\n  vcs-svn: remove custom mode constants\n  vcs-svn: remove repo_delete wrapper function\n  vcs-svn: move remaining repo_tree functions to fast_export.h\n\n Makefile              |  1 -\n vcs-svn/fast_export.c | 41 +++++++++++++++++++++++++++++++++++++----\n vcs-svn/fast_export.h |  3 +++\n vcs-svn/repo_tree.c   | 48 ------------------------------------------------\n vcs-svn/repo_tree.h   | 23 -----------------------\n vcs-svn/svndump.c     | 33 ++++++++++++++++-----------------\n 6 files changed, 56 insertions(+), 93 deletions(-)\n delete mode 100644 vcs-svn/repo_tree.c\n delete mode 100644 vcs-svn/repo_tree.h\n\n[1] https://public-inbox.org/git/20170822213501.5928-1-sbeller@google.com\n[2] https://public-inbox.org/git/20170821000022.26729-3-sandals@crustytoothpaste.net\n"},{"id":"326995","messageId":"20170822233837.GY13924@aiede.mtv.corp.google.com","threadId":"46656","inReplyTo":"20170822233732.GX13924@aiede.mtv.corp.google.com","subject":"[PATCH 1/4] vcs-svn: remove prototypes for missing functions","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2017-08-22T23:38:37Z","receivedAt":"2017-08-22T23:38:45Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"I forgot to remove these prototypes when removing these functions in\nv1.7.10-rc0~118^2~4^2~5^2~4 (vcs-svn: eliminate repo_tree structure,\n2010-12-10).\n\nNoticed by building a new file that included both repo_tree.h and\nrepository.h (\"error: conflicting types for 'repo_init'\").\n\nReported-by: brian m. carlson <sandals@crustytoothpaste.net>\nReported-by: Stefan Beller <sbeller@google.com>\nSigned-off-by: Jonathan Nieder <jrnieder@gmail.com>\n---\n vcs-svn/repo_tree.h | 10 ----------\n 1 file changed, 10 deletions(-)\n\ndiff --git a/vcs-svn/repo_tree.h b/vcs-svn/repo_tree.h\nindex 889c6a3c95..6c2f5f8a00 100644\n--- a/vcs-svn/repo_tree.h\n+++ b/vcs-svn/repo_tree.h\n@@ -1,23 +1,13 @@\n #ifndef REPO_TREE_H_\n #define REPO_TREE_H_\n \n-struct strbuf;\n-\n #define REPO_MODE_DIR 0040000\n #define REPO_MODE_BLB 0100644\n #define REPO_MODE_EXE 0100755\n #define REPO_MODE_LNK 0120000\n \n-uint32_t next_blob_mark(void);\n void repo_copy(uint32_t revision, const char *src, const char *dst);\n-void repo_add(const char *path, uint32_t mode, uint32_t blob_mark);\n const char *repo_read_path(const char *path, uint32_t *mode_out);\n void repo_delete(const char *path);\n-void repo_commit(uint32_t revision, const char *author,\n-\t\tconst struct strbuf *log, const char *uuid, const char *url,\n-\t\tlong unsigned timestamp);\n-void repo_diff(uint32_t r1, uint32_t r2);\n-void repo_init(void);\n-void repo_reset(void);\n \n #endif\n-- \n2.14.1.342.g6490525c54\n\n"},{"id":"326996","messageId":"20170822233935.GZ13924@aiede.mtv.corp.google.com","threadId":"46656","inReplyTo":"20170822233732.GX13924@aiede.mtv.corp.google.com","subject":"[PATCH 2/4] vcs-svn: remove custom mode constants","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2017-08-22T23:39:35Z","receivedAt":"2017-08-22T23:39:44Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"In the rest of Git, these modes are spelled as S_IFDIR,\nS_IFREG | 0644, S_IFREG | 0755, and S_IFLNK.  Use the same constants\nin svn-fe for simplicity and consistency.\n\nNo functional change intended.\n\nSigned-off-by: Jonathan Nieder <jrnieder@gmail.com>\n---\n vcs-svn/fast_export.c |  6 +++---\n vcs-svn/repo_tree.c   |  2 +-\n vcs-svn/repo_tree.h   |  5 -----\n vcs-svn/svndump.c     | 24 ++++++++++++------------\n 4 files changed, 16 insertions(+), 21 deletions(-)\n\ndiff --git a/vcs-svn/fast_export.c b/vcs-svn/fast_export.c\nindex 5a89db30e3..7790f8e1d1 100644\n--- a/vcs-svn/fast_export.c\n+++ b/vcs-svn/fast_export.c\n@@ -210,7 +210,7 @@ static long apply_delta(off_t len, struct line_buffer *input,\n \t\t\tdie(\"invalid cat-blob response: %s\", response);\n \t\tcheck_preimage_overflow(preimage.max_off, 1);\n \t}\n-\tif (old_mode == REPO_MODE_LNK) {\n+\tif (old_mode == S_IFLNK) {\n \t\tstrbuf_addstr(&preimage.buf, \"link \");\n \t\tcheck_preimage_overflow(preimage.max_off, strlen(\"link \"));\n \t\tpreimage.max_off += strlen(\"link \");\n@@ -244,7 +244,7 @@ void fast_export_buf_to_data(const struct strbuf *data)\n void fast_export_data(uint32_t mode, off_t len, struct line_buffer *input)\n {\n \tassert(len >= 0);\n-\tif (mode == REPO_MODE_LNK) {\n+\tif (mode == S_IFLNK) {\n \t\t/* svn symlink blobs start with \"link \" */\n \t\tif (len < 5)\n \t\t\tdie(\"invalid dump: symlink too short for \\\"link\\\" prefix\");\n@@ -320,7 +320,7 @@ void fast_export_blob_delta(uint32_t mode,\n \n \tassert(len >= 0);\n \tpostimage_len = apply_delta(len, input, old_data, old_mode);\n-\tif (mode == REPO_MODE_LNK) {\n+\tif (mode == S_IFLNK) {\n \t\tbuffer_skip_bytes(&postimage, strlen(\"link \"));\n \t\tpostimage_len -= strlen(\"link \");\n \t}\ndiff --git a/vcs-svn/repo_tree.c b/vcs-svn/repo_tree.c\nindex 67d27f0b6c..9107f9663d 100644\n--- a/vcs-svn/repo_tree.c\n+++ b/vcs-svn/repo_tree.c\n@@ -19,7 +19,7 @@ const char *repo_read_path(const char *path, uint32_t *mode_out)\n \t\tif (errno != ENOENT)\n \t\t\tdie_errno(\"BUG: unexpected fast_export_ls error\");\n \t\t/* Treat missing paths as directories. */\n-\t\t*mode_out = REPO_MODE_DIR;\n+\t\t*mode_out = S_IFDIR;\n \t\treturn NULL;\n \t}\n \treturn buf.buf;\ndiff --git a/vcs-svn/repo_tree.h b/vcs-svn/repo_tree.h\nindex 6c2f5f8a00..7f59fd9148 100644\n--- a/vcs-svn/repo_tree.h\n+++ b/vcs-svn/repo_tree.h\n@@ -1,11 +1,6 @@\n #ifndef REPO_TREE_H_\n #define REPO_TREE_H_\n \n-#define REPO_MODE_DIR 0040000\n-#define REPO_MODE_BLB 0100644\n-#define REPO_MODE_EXE 0100755\n-#define REPO_MODE_LNK 0120000\n-\n void repo_copy(uint32_t revision, const char *src, const char *dst);\n const char *repo_read_path(const char *path, uint32_t *mode_out);\n void repo_delete(const char *path);\ndiff --git a/vcs-svn/svndump.c b/vcs-svn/svndump.c\nindex 1846685a21..dc42ae3316 100644\n--- a/vcs-svn/svndump.c\n+++ b/vcs-svn/svndump.c\n@@ -134,13 +134,13 @@ static void handle_property(const struct strbuf *key_buf,\n \t\t\tdie(\"invalid dump: sets type twice\");\n \t\t}\n \t\tif (!val) {\n-\t\t\tnode_ctx.type = REPO_MODE_BLB;\n+\t\t\tnode_ctx.type = S_IFREG | 0644;\n \t\t\treturn;\n \t\t}\n \t\t*type_set = 1;\n \t\tnode_ctx.type = keylen == strlen(\"svn:executable\") ?\n-\t\t\t\tREPO_MODE_EXE :\n-\t\t\t\tREPO_MODE_LNK;\n+\t\t\t\t(S_IFREG | 0755) :\n+\t\t\t\tS_IFLNK;\n \t}\n }\n \n@@ -219,7 +219,7 @@ static void handle_node(void)\n \t */\n \tstatic const char *const empty_blob = \"::empty::\";\n \tconst char *old_data = NULL;\n-\tuint32_t old_mode = REPO_MODE_BLB;\n+\tuint32_t old_mode = S_IFREG | 0644;\n \n \tif (node_ctx.action == NODEACT_DELETE) {\n \t\tif (have_text || have_props || node_ctx.srcRev)\n@@ -237,27 +237,27 @@ static void handle_node(void)\n \t\tif (node_ctx.action == NODEACT_ADD)\n \t\t\tnode_ctx.action = NODEACT_CHANGE;\n \t}\n-\tif (have_text && type == REPO_MODE_DIR)\n+\tif (have_text && type == S_IFDIR)\n \t\tdie(\"invalid dump: directories cannot have text attached\");\n \n \t/*\n \t * Find old content (old_data) and decide on the new mode.\n \t */\n \tif (node_ctx.action == NODEACT_CHANGE && !*node_ctx.dst.buf) {\n-\t\tif (type != REPO_MODE_DIR)\n+\t\tif (type != S_IFDIR)\n \t\t\tdie(\"invalid dump: root of tree is not a regular file\");\n \t\told_data = NULL;\n \t} else if (node_ctx.action == NODEACT_CHANGE) {\n \t\tuint32_t mode;\n \t\told_data = repo_read_path(node_ctx.dst.buf, &mode);\n-\t\tif (mode == REPO_MODE_DIR && type != REPO_MODE_DIR)\n+\t\tif (mode == S_IFDIR && type != S_IFDIR)\n \t\t\tdie(\"invalid dump: cannot modify a directory into a file\");\n-\t\tif (mode != REPO_MODE_DIR && type == REPO_MODE_DIR)\n+\t\tif (mode != S_IFDIR && type == S_IFDIR)\n \t\t\tdie(\"invalid dump: cannot modify a file into a directory\");\n \t\tnode_ctx.type = mode;\n \t\told_mode = mode;\n \t} else if (node_ctx.action == NODEACT_ADD) {\n-\t\tif (type == REPO_MODE_DIR)\n+\t\tif (type == S_IFDIR)\n \t\t\told_data = NULL;\n \t\telse if (have_text)\n \t\t\told_data = empty_blob;\n@@ -280,7 +280,7 @@ static void handle_node(void)\n \t/*\n \t * Save the result.\n \t */\n-\tif (type == REPO_MODE_DIR)\t/* directories are not tracked. */\n+\tif (type == S_IFDIR)\t/* directories are not tracked. */\n \t\treturn;\n \tassert(old_data);\n \tif (old_data == empty_blob)\n@@ -385,9 +385,9 @@ void svndump_read(const char *url, const char *local_ref, const char *notes_ref)\n \t\t\t\tcontinue;\n \t\t\tstrbuf_addf(&rev_ctx.note, \"%s\\n\", t);\n \t\t\tif (!strcmp(val, \"dir\"))\n-\t\t\t\tnode_ctx.type = REPO_MODE_DIR;\n+\t\t\t\tnode_ctx.type = S_IFDIR;\n \t\t\telse if (!strcmp(val, \"file\"))\n-\t\t\t\tnode_ctx.type = REPO_MODE_BLB;\n+\t\t\t\tnode_ctx.type = S_IFREG | 0644;\n \t\t\telse\n \t\t\t\tfprintf(stderr, \"Unknown node-kind: %s\\n\", val);\n \t\t\tbreak;\n-- \n2.14.1.342.g6490525c54\n\n"},{"id":"326997","messageId":"20170822234017.GA13924@aiede.mtv.corp.google.com","threadId":"46656","inReplyTo":"20170822233732.GX13924@aiede.mtv.corp.google.com","subject":"[PATCH 3/4] vcs-svn: remove repo_delete wrapper function","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2017-08-22T23:40:17Z","receivedAt":"2017-08-22T23:40:24Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Since v1.7.10-rc0~118^2~4^2~4^2~3 (vcs-svn: pass paths through to\nfast-import, 2010-12-13) this is an alias for fast_export_delete.\nRemove the unnecessary layer of indirection.\n\nNo functional change intended.\n\nSigned-off-by: Jonathan Nieder <jrnieder@gmail.com>\n---\n vcs-svn/repo_tree.c | 5 -----\n vcs-svn/repo_tree.h | 1 -\n vcs-svn/svndump.c   | 4 ++--\n 3 files changed, 2 insertions(+), 8 deletions(-)\n\ndiff --git a/vcs-svn/repo_tree.c b/vcs-svn/repo_tree.c\nindex 9107f9663d..99747e373a 100644\n--- a/vcs-svn/repo_tree.c\n+++ b/vcs-svn/repo_tree.c\n@@ -41,8 +41,3 @@ void repo_copy(uint32_t revision, const char *src, const char *dst)\n \t}\n \tfast_export_modify(dst, mode, data.buf);\n }\n-\n-void repo_delete(const char *path)\n-{\n-\tfast_export_delete(path);\n-}\ndiff --git a/vcs-svn/repo_tree.h b/vcs-svn/repo_tree.h\nindex 7f59fd9148..56a3209d01 100644\n--- a/vcs-svn/repo_tree.h\n+++ b/vcs-svn/repo_tree.h\n@@ -3,6 +3,5 @@\n \n void repo_copy(uint32_t revision, const char *src, const char *dst);\n const char *repo_read_path(const char *path, uint32_t *mode_out);\n-void repo_delete(const char *path);\n \n #endif\ndiff --git a/vcs-svn/svndump.c b/vcs-svn/svndump.c\nindex dc42ae3316..d51136fac5 100644\n--- a/vcs-svn/svndump.c\n+++ b/vcs-svn/svndump.c\n@@ -225,11 +225,11 @@ static void handle_node(void)\n \t\tif (have_text || have_props || node_ctx.srcRev)\n \t\t\tdie(\"invalid dump: deletion node has \"\n \t\t\t\t\"copyfrom info, text, or properties\");\n-\t\trepo_delete(node_ctx.dst.buf);\n+\t\tfast_export_delete(node_ctx.dst.buf);\n \t\treturn;\n \t}\n \tif (node_ctx.action == NODEACT_REPLACE) {\n-\t\trepo_delete(node_ctx.dst.buf);\n+\t\tfast_export_delete(node_ctx.dst.buf);\n \t\tnode_ctx.action = NODEACT_ADD;\n \t}\n \tif (node_ctx.srcRev) {\n-- \n2.14.1.342.g6490525c54\n\n"},{"id":"326998","messageId":"20170822234216.GB13924@aiede.mtv.corp.google.com","threadId":"46656","inReplyTo":"20170822233732.GX13924@aiede.mtv.corp.google.com","subject":"[PATCH 4/4] vcs-svn: move remaining repo_tree functions to fast_export.h","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2017-08-22T23:42:16Z","receivedAt":"2017-08-22T23:42:24Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"These used to be for manipulating the in-memory repo_tree structure,\nbut nowadays they are convenience wrappers to handle a few git-vs-svn\nmismatches:\n\n 1. Git does not track empty directories but Subversion does.  When\n    looking up a path in git that Subversion thinks exists and finding\n    nothing, we can safely assume that the path represents a\n    directory.  This is needed when a later Subversion revision\n    modifies that directory.\n\n 2. Subversion allows deleting a file by copying.  In Git fast-import\n    we have to handle that more explicitly as a deletion.\n\nThese are details of the tool's interaction with git fast-import.\nMove them to fast_export.c, where other such details are handled.\n\nThis way the functions do not start with a repo_ prefix that would\nclash with the repository object introduced in v2.14.0-rc0~38^2~16\n(repository: introduce the repository object, 2017-06-22).\n\nReported-by: brian m. carlson <sandals@crustytoothpaste.net>\nSigned-off-by: Jonathan Nieder <jrnieder@gmail.com>\n---\n Makefile              |  1 -\n vcs-svn/fast_export.c | 35 ++++++++++++++++++++++++++++++++++-\n vcs-svn/fast_export.h |  3 +++\n vcs-svn/repo_tree.c   | 43 -------------------------------------------\n vcs-svn/repo_tree.h   |  7 -------\n vcs-svn/svndump.c     |  5 ++---\n 6 files changed, 39 insertions(+), 55 deletions(-)\n delete mode 100644 vcs-svn/repo_tree.c\n delete mode 100644 vcs-svn/repo_tree.h\n\ndiff --git a/Makefile b/Makefile\nindex 86ec29202b..493b8f5d2d 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -2038,7 +2038,6 @@ XDIFF_OBJS += xdiff/xhistogram.o\n \n VCSSVN_OBJS += vcs-svn/line_buffer.o\n VCSSVN_OBJS += vcs-svn/sliding_window.o\n-VCSSVN_OBJS += vcs-svn/repo_tree.o\n VCSSVN_OBJS += vcs-svn/fast_export.o\n VCSSVN_OBJS += vcs-svn/svndiff.o\n VCSSVN_OBJS += vcs-svn/svndump.o\ndiff --git a/vcs-svn/fast_export.c b/vcs-svn/fast_export.c\nindex 7790f8e1d1..3fd047a8b8 100644\n--- a/vcs-svn/fast_export.c\n+++ b/vcs-svn/fast_export.c\n@@ -6,7 +6,6 @@\n #include \"cache.h\"\n #include \"quote.h\"\n #include \"fast_export.h\"\n-#include \"repo_tree.h\"\n #include \"strbuf.h\"\n #include \"svndiff.h\"\n #include \"sliding_window.h\"\n@@ -312,6 +311,40 @@ int fast_export_ls(const char *path, uint32_t *mode, struct strbuf *dataref)\n \treturn parse_ls_response(get_response_line(), mode, dataref);\n }\n \n+const char *fast_export_read_path(const char *path, uint32_t *mode_out)\n+{\n+\tint err;\n+\tstatic struct strbuf buf = STRBUF_INIT;\n+\n+\tstrbuf_reset(&buf);\n+\terr = fast_export_ls(path, mode_out, &buf);\n+\tif (err) {\n+\t\tif (errno != ENOENT)\n+\t\t\tdie_errno(\"BUG: unexpected fast_export_ls error\");\n+\t\t/* Treat missing paths as directories. */\n+\t\t*mode_out = S_IFDIR;\n+\t\treturn NULL;\n+\t}\n+\treturn buf.buf;\n+}\n+\n+void fast_export_copy(uint32_t revision, const char *src, const char *dst)\n+{\n+\tint err;\n+\tuint32_t mode;\n+\tstatic struct strbuf data = STRBUF_INIT;\n+\n+\tstrbuf_reset(&data);\n+\terr = fast_export_ls_rev(revision, src, &mode, &data);\n+\tif (err) {\n+\t\tif (errno != ENOENT)\n+\t\t\tdie_errno(\"BUG: unexpected fast_export_ls_rev error\");\n+\t\tfast_export_delete(dst);\n+\t\treturn;\n+\t}\n+\tfast_export_modify(dst, mode, data.buf);\n+}\n+\n void fast_export_blob_delta(uint32_t mode,\n \t\t\t\tuint32_t old_mode, const char *old_data,\n \t\t\t\toff_t len, struct line_buffer *input)\ndiff --git a/vcs-svn/fast_export.h b/vcs-svn/fast_export.h\nindex b9a3b71c99..60b79c35b9 100644\n--- a/vcs-svn/fast_export.h\n+++ b/vcs-svn/fast_export.h\n@@ -28,4 +28,7 @@ int fast_export_ls_rev(uint32_t rev, const char *path,\n int fast_export_ls(const char *path,\n \t\t\tuint32_t *mode_out, struct strbuf *dataref_out);\n \n+void fast_export_copy(uint32_t revision, const char *src, const char *dst);\n+const char *fast_export_read_path(const char *path, uint32_t *mode_out);\n+\n #endif\ndiff --git a/vcs-svn/repo_tree.c b/vcs-svn/repo_tree.c\ndeleted file mode 100644\nindex 99747e373a..0000000000\n--- a/vcs-svn/repo_tree.c\n+++ /dev/null\n@@ -1,43 +0,0 @@\n-/*\n- * Licensed under a two-clause BSD-style license.\n- * See LICENSE for details.\n- */\n-\n-#include \"git-compat-util.h\"\n-#include \"strbuf.h\"\n-#include \"repo_tree.h\"\n-#include \"fast_export.h\"\n-\n-const char *repo_read_path(const char *path, uint32_t *mode_out)\n-{\n-\tint err;\n-\tstatic struct strbuf buf = STRBUF_INIT;\n-\n-\tstrbuf_reset(&buf);\n-\terr = fast_export_ls(path, mode_out, &buf);\n-\tif (err) {\n-\t\tif (errno != ENOENT)\n-\t\t\tdie_errno(\"BUG: unexpected fast_export_ls error\");\n-\t\t/* Treat missing paths as directories. */\n-\t\t*mode_out = S_IFDIR;\n-\t\treturn NULL;\n-\t}\n-\treturn buf.buf;\n-}\n-\n-void repo_copy(uint32_t revision, const char *src, const char *dst)\n-{\n-\tint err;\n-\tuint32_t mode;\n-\tstatic struct strbuf data = STRBUF_INIT;\n-\n-\tstrbuf_reset(&data);\n-\terr = fast_export_ls_rev(revision, src, &mode, &data);\n-\tif (err) {\n-\t\tif (errno != ENOENT)\n-\t\t\tdie_errno(\"BUG: unexpected fast_export_ls_rev error\");\n-\t\tfast_export_delete(dst);\n-\t\treturn;\n-\t}\n-\tfast_export_modify(dst, mode, data.buf);\n-}\ndiff --git a/vcs-svn/repo_tree.h b/vcs-svn/repo_tree.h\ndeleted file mode 100644\nindex 56a3209d01..0000000000\n--- a/vcs-svn/repo_tree.h\n+++ /dev/null\n@@ -1,7 +0,0 @@\n-#ifndef REPO_TREE_H_\n-#define REPO_TREE_H_\n-\n-void repo_copy(uint32_t revision, const char *src, const char *dst);\n-const char *repo_read_path(const char *path, uint32_t *mode_out);\n-\n-#endif\ndiff --git a/vcs-svn/svndump.c b/vcs-svn/svndump.c\nindex d51136fac5..ec6b350611 100644\n--- a/vcs-svn/svndump.c\n+++ b/vcs-svn/svndump.c\n@@ -8,7 +8,6 @@\n  */\n \n #include \"cache.h\"\n-#include \"repo_tree.h\"\n #include \"fast_export.h\"\n #include \"line_buffer.h\"\n #include \"strbuf.h\"\n@@ -233,7 +232,7 @@ static void handle_node(void)\n \t\tnode_ctx.action = NODEACT_ADD;\n \t}\n \tif (node_ctx.srcRev) {\n-\t\trepo_copy(node_ctx.srcRev, node_ctx.src.buf, node_ctx.dst.buf);\n+\t\tfast_export_copy(node_ctx.srcRev, node_ctx.src.buf, node_ctx.dst.buf);\n \t\tif (node_ctx.action == NODEACT_ADD)\n \t\t\tnode_ctx.action = NODEACT_CHANGE;\n \t}\n@@ -249,7 +248,7 @@ static void handle_node(void)\n \t\told_data = NULL;\n \t} else if (node_ctx.action == NODEACT_CHANGE) {\n \t\tuint32_t mode;\n-\t\told_data = repo_read_path(node_ctx.dst.buf, &mode);\n+\t\told_data = fast_export_read_path(node_ctx.dst.buf, &mode);\n \t\tif (mode == S_IFDIR && type != S_IFDIR)\n \t\t\tdie(\"invalid dump: cannot modify a directory into a file\");\n \t\tif (mode != S_IFDIR && type == S_IFDIR)\n-- \n2.14.1.342.g6490525c54\n\n"},{"id":"326999","messageId":"CAGZ79kbkLyYTrvkUfsfHsUJstq-7Mj=c8vz2aZVojcXsy1fhog@mail.gmail.com","threadId":"46656","inReplyTo":"20170822233732.GX13924@aiede.mtv.corp.google.com","subject":"Re: [PATCH 0/4] vcs-svn: remove repo_tree library","fromName":"Stefan Beller","fromEmail":"sbeller@google.com","sentAt":"2017-08-22T23:44:45Z","receivedAt":"2017-08-22T23:44:51Z","isPatch":true,"sender":{"key":"stefanbeller@gmail.com","avatar":"https://avatars.githubusercontent.com/u/455868?v=4"},"body":"On Tue, Aug 22, 2017 at 4:37 PM, Jonathan Nieder <jrnieder@gmail.com> wrote:\n> Hi,\n>\n> Stefan noticed that repo_init from vcs-svn/repo_tree.h conflicts with\n> repository.h[1].  Earlier brian m. carlson noticed the same thing[2].\n>\n> Originally repo_tree.h was used to manage an in-memory representation\n> of the state of the svn tree being imported.  When that in-memory\n> representation was retired, we were lazy and left some utility\n> functions there.  Here is a patch series to finish cleaning up and\n> remove vcs-svn/repo_tree.h completely.\n>\n> This is an alternative to bc/vcs-svn-cleanup from 'next'.  Those\n> patches weren't cc-ed to me and I missed them --- sorry about that.  I\n> can rebase on top of them if that is more convenient.\n\nA rebased version would be easier IIUC Junios reply to\nthe one-off that I sent.\n\nThe patches look good.\n\nThanks,\nStefan\n\n>\n> Thoughts of all kinds welcome, as always.\n>\n> Thanks,\n> Jonathan\n>\n> Jonathan Nieder (4):\n>   vcs-svn: remove prototypes for missing functions\n>   vcs-svn: remove custom mode constants\n>   vcs-svn: remove repo_delete wrapper function\n>   vcs-svn: move remaining repo_tree functions to fast_export.h\n>\n>  Makefile              |  1 -\n>  vcs-svn/fast_export.c | 41 +++++++++++++++++++++++++++++++++++++----\n>  vcs-svn/fast_export.h |  3 +++\n>  vcs-svn/repo_tree.c   | 48 ------------------------------------------------\n>  vcs-svn/repo_tree.h   | 23 -----------------------\n>  vcs-svn/svndump.c     | 33 ++++++++++++++++-----------------\n>  6 files changed, 56 insertions(+), 93 deletions(-)\n>  delete mode 100644 vcs-svn/repo_tree.c\n>  delete mode 100644 vcs-svn/repo_tree.h\n>\n> [1] https://public-inbox.org/git/20170822213501.5928-1-sbeller@google.com\n> [2] https://public-inbox.org/git/20170821000022.26729-3-sandals@crustytoothpaste.net\n"},{"id":"327001","messageId":"20170823000007.GD13924@aiede.mtv.corp.google.com","threadId":"46656","inReplyTo":"20170822233732.GX13924@aiede.mtv.corp.google.com","subject":"[PATCH v2 bc/vcs-svn-cleanup] vcs-svn: remove repo_tree library","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2017-08-23T00:00:07Z","receivedAt":"2017-08-23T00:00:18Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Hi again,\n\nJonathan Nieder wrote:\n\n> This is an alternative to bc/vcs-svn-cleanup from 'next'.  Those\n> patches weren't cc-ed to me and I missed them --- sorry about that.  I\n> can rebase on top of them if that is more convenient.\n\nHere is the same series rebased on top of bc/vcs-svn-cleanup.\n\nThoughts welcome, as always.\n\nJonathan Nieder (4):\n  vcs-svn: remove more unused prototypes and declarations\n  vcs-svn: remove custom mode constants\n  vcs-svn: remove repo_delete wrapper function\n  vcs-svn: move remaining repo_tree functions to fast_export.h\n\n Makefile              |  1 -\n vcs-svn/fast_export.c | 41 +++++++++++++++++++++++++++++++++++++----\n vcs-svn/fast_export.h |  3 +++\n vcs-svn/repo_tree.c   | 48 ------------------------------------------------\n vcs-svn/repo_tree.h   | 16 ----------------\n vcs-svn/svndump.c     | 33 ++++++++++++++++-----------------\n 6 files changed, 56 insertions(+), 86 deletions(-)\n delete mode 100644 vcs-svn/repo_tree.c\n delete mode 100644 vcs-svn/repo_tree.h\n\n> [1] https://public-inbox.org/git/20170822213501.5928-1-sbeller@google.com\n> [2] https://public-inbox.org/git/20170821000022.26729-3-sandals@crustytoothpaste.net\n"},{"id":"327002","messageId":"20170823000057.GE13924@aiede.mtv.corp.google.com","threadId":"46656","inReplyTo":"20170823000007.GD13924@aiede.mtv.corp.google.com","subject":"[PATCH v2 1/4] vcs-svn: remove more unused prototypes and declarations","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2017-08-23T00:00:57Z","receivedAt":"2017-08-23T00:01:04Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"I forgot to remove these in v1.7.10-rc0~118^2~4^2~5^2~4 (vcs-svn:\neliminate repo_tree structure, 2010-12-10).\n\nThis finishes what was started in commit 36f63b50 (vcs-svn: remove\nunused prototypes, 2017-08-21).\n\nSigned-off-by: Jonathan Nieder <jrnieder@gmail.com>\n---\n vcs-svn/repo_tree.h | 3 ---\n 1 file changed, 3 deletions(-)\n\ndiff --git a/vcs-svn/repo_tree.h b/vcs-svn/repo_tree.h\nindex 555b64bbb6..0d3bbb677d 100644\n--- a/vcs-svn/repo_tree.h\n+++ b/vcs-svn/repo_tree.h\n@@ -1,14 +1,11 @@\n #ifndef REPO_TREE_H_\n #define REPO_TREE_H_\n \n-struct strbuf;\n-\n #define REPO_MODE_DIR 0040000\n #define REPO_MODE_BLB 0100644\n #define REPO_MODE_EXE 0100755\n #define REPO_MODE_LNK 0120000\n \n-uint32_t next_blob_mark(void);\n void svn_repo_copy(uint32_t revision, const char *src, const char *dst);\n const char *svn_repo_read_path(const char *path, uint32_t *mode_out);\n void svn_repo_delete(const char *path);\n-- \n2.14.1.342.g6490525c54\n\n"},{"id":"327003","messageId":"20170823000134.GF13924@aiede.mtv.corp.google.com","threadId":"46656","inReplyTo":"20170823000007.GD13924@aiede.mtv.corp.google.com","subject":"[PATCH v2 2/4] vcs-svn: remove custom mode constants","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2017-08-23T00:01:34Z","receivedAt":"2017-08-23T00:01:43Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"In the rest of Git, these modes are spelled as S_IFDIR,\nS_IFREG | 0644, S_IFREG | 0755, and S_IFLNK.  Use the same constants\nin svn-fe for simplicity and consistency.\n\nNo functional change intended.\n\nSigned-off-by: Jonathan Nieder <jrnieder@gmail.com>\n---\nUnchanged.\n\n vcs-svn/fast_export.c |  6 +++---\n vcs-svn/repo_tree.c   |  2 +-\n vcs-svn/repo_tree.h   |  5 -----\n vcs-svn/svndump.c     | 24 ++++++++++++------------\n 4 files changed, 16 insertions(+), 21 deletions(-)\n\ndiff --git a/vcs-svn/fast_export.c b/vcs-svn/fast_export.c\nindex 97cba39cdf..6d133ed6bc 100644\n--- a/vcs-svn/fast_export.c\n+++ b/vcs-svn/fast_export.c\n@@ -210,7 +210,7 @@ static long apply_delta(off_t len, struct line_buffer *input,\n \t\t\tdie(\"invalid cat-blob response: %s\", response);\n \t\tcheck_preimage_overflow(preimage.max_off, 1);\n \t}\n-\tif (old_mode == REPO_MODE_LNK) {\n+\tif (old_mode == S_IFLNK) {\n \t\tstrbuf_addstr(&preimage.buf, \"link \");\n \t\tcheck_preimage_overflow(preimage.max_off, strlen(\"link \"));\n \t\tpreimage.max_off += strlen(\"link \");\n@@ -244,7 +244,7 @@ void fast_export_buf_to_data(const struct strbuf *data)\n void fast_export_data(uint32_t mode, off_t len, struct line_buffer *input)\n {\n \tassert(len >= 0);\n-\tif (mode == REPO_MODE_LNK) {\n+\tif (mode == S_IFLNK) {\n \t\t/* svn symlink blobs start with \"link \" */\n \t\tif (len < 5)\n \t\t\tdie(\"invalid dump: symlink too short for \\\"link\\\" prefix\");\n@@ -320,7 +320,7 @@ void fast_export_blob_delta(uint32_t mode,\n \n \tassert(len >= 0);\n \tpostimage_len = apply_delta(len, input, old_data, old_mode);\n-\tif (mode == REPO_MODE_LNK) {\n+\tif (mode == S_IFLNK) {\n \t\tbuffer_skip_bytes(&postimage, strlen(\"link \"));\n \t\tpostimage_len -= strlen(\"link \");\n \t}\ndiff --git a/vcs-svn/repo_tree.c b/vcs-svn/repo_tree.c\nindex d77cb0ada7..1a6f32d7cb 100644\n--- a/vcs-svn/repo_tree.c\n+++ b/vcs-svn/repo_tree.c\n@@ -19,7 +19,7 @@ const char *svn_repo_read_path(const char *path, uint32_t *mode_out)\n \t\tif (errno != ENOENT)\n \t\t\tdie_errno(\"BUG: unexpected fast_export_ls error\");\n \t\t/* Treat missing paths as directories. */\n-\t\t*mode_out = REPO_MODE_DIR;\n+\t\t*mode_out = S_IFDIR;\n \t\treturn NULL;\n \t}\n \treturn buf.buf;\ndiff --git a/vcs-svn/repo_tree.h b/vcs-svn/repo_tree.h\nindex 0d3bbb677d..c840bc9bae 100644\n--- a/vcs-svn/repo_tree.h\n+++ b/vcs-svn/repo_tree.h\n@@ -1,11 +1,6 @@\n #ifndef REPO_TREE_H_\n #define REPO_TREE_H_\n \n-#define REPO_MODE_DIR 0040000\n-#define REPO_MODE_BLB 0100644\n-#define REPO_MODE_EXE 0100755\n-#define REPO_MODE_LNK 0120000\n-\n void svn_repo_copy(uint32_t revision, const char *src, const char *dst);\n const char *svn_repo_read_path(const char *path, uint32_t *mode_out);\n void svn_repo_delete(const char *path);\ndiff --git a/vcs-svn/svndump.c b/vcs-svn/svndump.c\nindex 7da84b2aab..c0fa4eb723 100644\n--- a/vcs-svn/svndump.c\n+++ b/vcs-svn/svndump.c\n@@ -134,13 +134,13 @@ static void handle_property(const struct strbuf *key_buf,\n \t\t\tdie(\"invalid dump: sets type twice\");\n \t\t}\n \t\tif (!val) {\n-\t\t\tnode_ctx.type = REPO_MODE_BLB;\n+\t\t\tnode_ctx.type = S_IFREG | 0644;\n \t\t\treturn;\n \t\t}\n \t\t*type_set = 1;\n \t\tnode_ctx.type = keylen == strlen(\"svn:executable\") ?\n-\t\t\t\tREPO_MODE_EXE :\n-\t\t\t\tREPO_MODE_LNK;\n+\t\t\t\t(S_IFREG | 0755) :\n+\t\t\t\tS_IFLNK;\n \t}\n }\n \n@@ -219,7 +219,7 @@ static void handle_node(void)\n \t */\n \tstatic const char *const empty_blob = \"::empty::\";\n \tconst char *old_data = NULL;\n-\tuint32_t old_mode = REPO_MODE_BLB;\n+\tuint32_t old_mode = S_IFREG | 0644;\n \n \tif (node_ctx.action == NODEACT_DELETE) {\n \t\tif (have_text || have_props || node_ctx.srcRev)\n@@ -237,27 +237,27 @@ static void handle_node(void)\n \t\tif (node_ctx.action == NODEACT_ADD)\n \t\t\tnode_ctx.action = NODEACT_CHANGE;\n \t}\n-\tif (have_text && type == REPO_MODE_DIR)\n+\tif (have_text && type == S_IFDIR)\n \t\tdie(\"invalid dump: directories cannot have text attached\");\n \n \t/*\n \t * Find old content (old_data) and decide on the new mode.\n \t */\n \tif (node_ctx.action == NODEACT_CHANGE && !*node_ctx.dst.buf) {\n-\t\tif (type != REPO_MODE_DIR)\n+\t\tif (type != S_IFDIR)\n \t\t\tdie(\"invalid dump: root of tree is not a regular file\");\n \t\told_data = NULL;\n \t} else if (node_ctx.action == NODEACT_CHANGE) {\n \t\tuint32_t mode;\n \t\told_data = svn_repo_read_path(node_ctx.dst.buf, &mode);\n-\t\tif (mode == REPO_MODE_DIR && type != REPO_MODE_DIR)\n+\t\tif (mode == S_IFDIR && type != S_IFDIR)\n \t\t\tdie(\"invalid dump: cannot modify a directory into a file\");\n-\t\tif (mode != REPO_MODE_DIR && type == REPO_MODE_DIR)\n+\t\tif (mode != S_IFDIR && type == S_IFDIR)\n \t\t\tdie(\"invalid dump: cannot modify a file into a directory\");\n \t\tnode_ctx.type = mode;\n \t\told_mode = mode;\n \t} else if (node_ctx.action == NODEACT_ADD) {\n-\t\tif (type == REPO_MODE_DIR)\n+\t\tif (type == S_IFDIR)\n \t\t\told_data = NULL;\n \t\telse if (have_text)\n \t\t\told_data = empty_blob;\n@@ -280,7 +280,7 @@ static void handle_node(void)\n \t/*\n \t * Save the result.\n \t */\n-\tif (type == REPO_MODE_DIR)\t/* directories are not tracked. */\n+\tif (type == S_IFDIR)\t/* directories are not tracked. */\n \t\treturn;\n \tassert(old_data);\n \tif (old_data == empty_blob)\n@@ -385,9 +385,9 @@ void svndump_read(const char *url, const char *local_ref, const char *notes_ref)\n \t\t\t\tcontinue;\n \t\t\tstrbuf_addf(&rev_ctx.note, \"%s\\n\", t);\n \t\t\tif (!strcmp(val, \"dir\"))\n-\t\t\t\tnode_ctx.type = REPO_MODE_DIR;\n+\t\t\t\tnode_ctx.type = S_IFDIR;\n \t\t\telse if (!strcmp(val, \"file\"))\n-\t\t\t\tnode_ctx.type = REPO_MODE_BLB;\n+\t\t\t\tnode_ctx.type = S_IFREG | 0644;\n \t\t\telse\n \t\t\t\tfprintf(stderr, \"Unknown node-kind: %s\\n\", val);\n \t\t\tbreak;\n-- \n2.14.1.342.g6490525c54\n\n"},{"id":"327004","messageId":"20170823000215.GG13924@aiede.mtv.corp.google.com","threadId":"46656","inReplyTo":"20170823000007.GD13924@aiede.mtv.corp.google.com","subject":"[PATCH v2 3/4] vcs-svn: remove repo_delete wrapper function","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2017-08-23T00:02:15Z","receivedAt":"2017-08-23T00:02:23Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Since v1.7.10-rc0~118^2~4^2~4^2~3 (vcs-svn: pass paths through to\nfast-import, 2010-12-13) this is an alias for fast_export_delete.\nRemove the unnecessary layer of indirection.\n\nNo functional change intended.\n\nSigned-off-by: Jonathan Nieder <jrnieder@gmail.com>\n---\nUnchanged.\n\n vcs-svn/repo_tree.c | 5 -----\n vcs-svn/repo_tree.h | 1 -\n vcs-svn/svndump.c   | 4 ++--\n 3 files changed, 2 insertions(+), 8 deletions(-)\n\ndiff --git a/vcs-svn/repo_tree.c b/vcs-svn/repo_tree.c\nindex 1a6f32d7cb..5bd4977cb6 100644\n--- a/vcs-svn/repo_tree.c\n+++ b/vcs-svn/repo_tree.c\n@@ -41,8 +41,3 @@ void svn_repo_copy(uint32_t revision, const char *src, const char *dst)\n \t}\n \tfast_export_modify(dst, mode, data.buf);\n }\n-\n-void svn_repo_delete(const char *path)\n-{\n-\tfast_export_delete(path);\n-}\ndiff --git a/vcs-svn/repo_tree.h b/vcs-svn/repo_tree.h\nindex c840bc9bae..0cd2761183 100644\n--- a/vcs-svn/repo_tree.h\n+++ b/vcs-svn/repo_tree.h\n@@ -3,6 +3,5 @@\n \n void svn_repo_copy(uint32_t revision, const char *src, const char *dst);\n const char *svn_repo_read_path(const char *path, uint32_t *mode_out);\n-void svn_repo_delete(const char *path);\n \n #endif\ndiff --git a/vcs-svn/svndump.c b/vcs-svn/svndump.c\nindex c0fa4eb723..41113119bd 100644\n--- a/vcs-svn/svndump.c\n+++ b/vcs-svn/svndump.c\n@@ -225,11 +225,11 @@ static void handle_node(void)\n \t\tif (have_text || have_props || node_ctx.srcRev)\n \t\t\tdie(\"invalid dump: deletion node has \"\n \t\t\t\t\"copyfrom info, text, or properties\");\n-\t\tsvn_repo_delete(node_ctx.dst.buf);\n+\t\tfast_export_delete(node_ctx.dst.buf);\n \t\treturn;\n \t}\n \tif (node_ctx.action == NODEACT_REPLACE) {\n-\t\tsvn_repo_delete(node_ctx.dst.buf);\n+\t\tfast_export_delete(node_ctx.dst.buf);\n \t\tnode_ctx.action = NODEACT_ADD;\n \t}\n \tif (node_ctx.srcRev) {\n-- \n2.14.1.342.g6490525c54\n\n"},{"id":"327005","messageId":"20170823000447.GH13924@aiede.mtv.corp.google.com","threadId":"46656","inReplyTo":"20170823000007.GD13924@aiede.mtv.corp.google.com","subject":"[PATCH v2 4/4] vcs-svn: move remaining repo_tree functions to fast_export.h","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2017-08-23T00:04:47Z","receivedAt":"2017-08-23T00:04:55Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"These used to be for manipulating the in-memory repo_tree structure,\nbut nowadays they are convenience wrappers to handle a few git-vs-svn\nmismatches:\n\n 1. Git does not track empty directories but Subversion does.  When\n    looking up a path in git that Subversion thinks exists and finding\n    nothing, we can safely assume that the path represents a\n    directory.  This is needed when a later Subversion revision\n    modifies that directory.\n\n 2. Subversion allows deleting a file by copying.  In Git fast-import\n    we have to handle that more explicitly as a deletion.\n\nThese are details of the tool's interaction with git fast-import.\nMove them to fast_export.c, where other such details are handled.\n\nThis way the function names do not start with a repo_ prefix that\nwould clash with the repository object introduced in\nv2.14.0-rc0~38^2~16 (repository: introduce the repository object,\n2017-06-22) or an svn_ prefix that would clash with libsvn (in case\nsomeone wants to link this code with libsvn some day).\n\nSigned-off-by: Jonathan Nieder <jrnieder@gmail.com>\n---\nThe only change is the commit message.  These functions are already\nnamespaced on the bc/vcs-svn-cleanup, so added a note about that.\n\nThat's the end of the series.  Thanks for reading.\n\n Makefile              |  1 -\n vcs-svn/fast_export.c | 35 ++++++++++++++++++++++++++++++++++-\n vcs-svn/fast_export.h |  3 +++\n vcs-svn/repo_tree.c   | 43 -------------------------------------------\n vcs-svn/repo_tree.h   |  7 -------\n vcs-svn/svndump.c     |  5 ++---\n 6 files changed, 39 insertions(+), 55 deletions(-)\n delete mode 100644 vcs-svn/repo_tree.c\n delete mode 100644 vcs-svn/repo_tree.h\n\ndiff --git a/Makefile b/Makefile\nindex 46ad908ec5..9b00d5b219 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -1942,7 +1942,6 @@ XDIFF_OBJS += xdiff/xhistogram.o\n \n VCSSVN_OBJS += vcs-svn/line_buffer.o\n VCSSVN_OBJS += vcs-svn/sliding_window.o\n-VCSSVN_OBJS += vcs-svn/repo_tree.o\n VCSSVN_OBJS += vcs-svn/fast_export.o\n VCSSVN_OBJS += vcs-svn/svndiff.o\n VCSSVN_OBJS += vcs-svn/svndump.o\ndiff --git a/vcs-svn/fast_export.c b/vcs-svn/fast_export.c\nindex 6d133ed6bc..5bd455b8c8 100644\n--- a/vcs-svn/fast_export.c\n+++ b/vcs-svn/fast_export.c\n@@ -6,7 +6,6 @@\n #include \"cache.h\"\n #include \"quote.h\"\n #include \"fast_export.h\"\n-#include \"repo_tree.h\"\n #include \"strbuf.h\"\n #include \"svndiff.h\"\n #include \"sliding_window.h\"\n@@ -312,6 +311,40 @@ int fast_export_ls(const char *path, uint32_t *mode, struct strbuf *dataref)\n \treturn parse_ls_response(get_response_line(), mode, dataref);\n }\n \n+const char *fast_export_read_path(const char *path, uint32_t *mode_out)\n+{\n+\tint err;\n+\tstatic struct strbuf buf = STRBUF_INIT;\n+\n+\tstrbuf_reset(&buf);\n+\terr = fast_export_ls(path, mode_out, &buf);\n+\tif (err) {\n+\t\tif (errno != ENOENT)\n+\t\t\tdie_errno(\"BUG: unexpected fast_export_ls error\");\n+\t\t/* Treat missing paths as directories. */\n+\t\t*mode_out = S_IFDIR;\n+\t\treturn NULL;\n+\t}\n+\treturn buf.buf;\n+}\n+\n+void fast_export_copy(uint32_t revision, const char *src, const char *dst)\n+{\n+\tint err;\n+\tuint32_t mode;\n+\tstatic struct strbuf data = STRBUF_INIT;\n+\n+\tstrbuf_reset(&data);\n+\terr = fast_export_ls_rev(revision, src, &mode, &data);\n+\tif (err) {\n+\t\tif (errno != ENOENT)\n+\t\t\tdie_errno(\"BUG: unexpected fast_export_ls_rev error\");\n+\t\tfast_export_delete(dst);\n+\t\treturn;\n+\t}\n+\tfast_export_modify(dst, mode, data.buf);\n+}\n+\n void fast_export_blob_delta(uint32_t mode,\n \t\t\t\tuint32_t old_mode, const char *old_data,\n \t\t\t\toff_t len, struct line_buffer *input)\ndiff --git a/vcs-svn/fast_export.h b/vcs-svn/fast_export.h\nindex c8b5adb811..ae8ab7e589 100644\n--- a/vcs-svn/fast_export.h\n+++ b/vcs-svn/fast_export.h\n@@ -28,4 +28,7 @@ int fast_export_ls_rev(uint32_t rev, const char *path,\n int fast_export_ls(const char *path,\n \t\t\tuint32_t *mode_out, struct strbuf *dataref_out);\n \n+void fast_export_copy(uint32_t revision, const char *src, const char *dst);\n+const char *fast_export_read_path(const char *path, uint32_t *mode_out);\n+\n #endif\ndiff --git a/vcs-svn/repo_tree.c b/vcs-svn/repo_tree.c\ndeleted file mode 100644\nindex 5bd4977cb6..0000000000\n--- a/vcs-svn/repo_tree.c\n+++ /dev/null\n@@ -1,43 +0,0 @@\n-/*\n- * Licensed under a two-clause BSD-style license.\n- * See LICENSE for details.\n- */\n-\n-#include \"git-compat-util.h\"\n-#include \"strbuf.h\"\n-#include \"repo_tree.h\"\n-#include \"fast_export.h\"\n-\n-const char *svn_repo_read_path(const char *path, uint32_t *mode_out)\n-{\n-\tint err;\n-\tstatic struct strbuf buf = STRBUF_INIT;\n-\n-\tstrbuf_reset(&buf);\n-\terr = fast_export_ls(path, mode_out, &buf);\n-\tif (err) {\n-\t\tif (errno != ENOENT)\n-\t\t\tdie_errno(\"BUG: unexpected fast_export_ls error\");\n-\t\t/* Treat missing paths as directories. */\n-\t\t*mode_out = S_IFDIR;\n-\t\treturn NULL;\n-\t}\n-\treturn buf.buf;\n-}\n-\n-void svn_repo_copy(uint32_t revision, const char *src, const char *dst)\n-{\n-\tint err;\n-\tuint32_t mode;\n-\tstatic struct strbuf data = STRBUF_INIT;\n-\n-\tstrbuf_reset(&data);\n-\terr = fast_export_ls_rev(revision, src, &mode, &data);\n-\tif (err) {\n-\t\tif (errno != ENOENT)\n-\t\t\tdie_errno(\"BUG: unexpected fast_export_ls_rev error\");\n-\t\tfast_export_delete(dst);\n-\t\treturn;\n-\t}\n-\tfast_export_modify(dst, mode, data.buf);\n-}\ndiff --git a/vcs-svn/repo_tree.h b/vcs-svn/repo_tree.h\ndeleted file mode 100644\nindex 0cd2761183..0000000000\n--- a/vcs-svn/repo_tree.h\n+++ /dev/null\n@@ -1,7 +0,0 @@\n-#ifndef REPO_TREE_H_\n-#define REPO_TREE_H_\n-\n-void svn_repo_copy(uint32_t revision, const char *src, const char *dst);\n-const char *svn_repo_read_path(const char *path, uint32_t *mode_out);\n-\n-#endif\ndiff --git a/vcs-svn/svndump.c b/vcs-svn/svndump.c\nindex 41113119bd..01b6ded400 100644\n--- a/vcs-svn/svndump.c\n+++ b/vcs-svn/svndump.c\n@@ -8,7 +8,6 @@\n  */\n \n #include \"cache.h\"\n-#include \"repo_tree.h\"\n #include \"fast_export.h\"\n #include \"line_buffer.h\"\n #include \"strbuf.h\"\n@@ -233,7 +232,7 @@ static void handle_node(void)\n \t\tnode_ctx.action = NODEACT_ADD;\n \t}\n \tif (node_ctx.srcRev) {\n-\t\tsvn_repo_copy(node_ctx.srcRev, node_ctx.src.buf, node_ctx.dst.buf);\n+\t\tfast_export_copy(node_ctx.srcRev, node_ctx.src.buf, node_ctx.dst.buf);\n \t\tif (node_ctx.action == NODEACT_ADD)\n \t\t\tnode_ctx.action = NODEACT_CHANGE;\n \t}\n@@ -249,7 +248,7 @@ static void handle_node(void)\n \t\told_data = NULL;\n \t} else if (node_ctx.action == NODEACT_CHANGE) {\n \t\tuint32_t mode;\n-\t\told_data = svn_repo_read_path(node_ctx.dst.buf, &mode);\n+\t\told_data = fast_export_read_path(node_ctx.dst.buf, &mode);\n \t\tif (mode == S_IFDIR && type != S_IFDIR)\n \t\t\tdie(\"invalid dump: cannot modify a directory into a file\");\n \t\tif (mode != S_IFDIR && type == S_IFDIR)\n-- \n2.14.1.342.g6490525c54\n\n"}]}