aboutsummaryrefslogtreecommitdiff
path: root/vcs-svn/repo_tree.c
diff options
context:
space:
mode:
authorJonathan Nieder <jrnieder@gmail.com>2010-11-20 13:25:28 -0600
committerJonathan Nieder <jrnieder@gmail.com>2011-03-07 00:56:50 -0600
commit4f5de755a7931c5e15f4e7fc3d501588aa9ff88d (patch)
tree5934c614ee2b1d3492ca25dca883a5562985723e /vcs-svn/repo_tree.c
parent6288e3e180c0b911e6f7062f1e744a25568f7d22 (diff)
downloadgit-4f5de755a7931c5e15f4e7fc3d501588aa9ff88d.tar.gz
git-4f5de755a7931c5e15f4e7fc3d501588aa9ff88d.tar.xz
vcs-svn: introduce repo_read_path to check the content at a path
The repo_tree structure remembers, for each path in each revision, a mode (regular file, executable, symlink, or directory) and content (blob mark or directory structure). Maintaining a second copy of all this information when it's already in the target repository is wasteful, it does not persist between svn-fe invocations, and most importantly, there is no convenient way to transfer it from one machine to another. So it would be nice to get rid of it. As a first step, let's change the repo_tree API to match fast-import's read commands more closely. Currently to read the mode for a path, one uses repo_modify_path(path, new_mode, new_content); which changes the mode and content as a side effect. There is no function to read the content at a path; add one. Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: David Barr <david.barr@cordelta.com> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Diffstat (limited to 'vcs-svn/repo_tree.c')
-rw-r--r--vcs-svn/repo_tree.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/vcs-svn/repo_tree.c b/vcs-svn/repo_tree.c
index 491f0135a..8763de5c2 100644
--- a/vcs-svn/repo_tree.c
+++ b/vcs-svn/repo_tree.c
@@ -87,7 +87,8 @@ static struct repo_dir *repo_clone_dir(struct repo_dir *orig_dir)
return dir_pointer(new_o);
}
-static struct repo_dirent *repo_read_dirent(uint32_t revision, uint32_t *path)
+static struct repo_dirent *repo_read_dirent(uint32_t revision,
+ const uint32_t *path)
{
uint32_t name = 0;
struct repo_dirent *key = dent_pointer(dent_alloc(1));
@@ -157,6 +158,15 @@ static void repo_write_dirent(uint32_t *path, uint32_t mode,
dent_remove(&dir_pointer(parent_dir_o)->entries, dent);
}
+uint32_t repo_read_path(const uint32_t *path)
+{
+ uint32_t content_offset = 0;
+ struct repo_dirent *dent = repo_read_dirent(active_commit, path);
+ if (dent != NULL)
+ content_offset = dent->content_offset;
+ return content_offset;
+}
+
uint32_t repo_copy(uint32_t revision, uint32_t *src, uint32_t *dst)
{
uint32_t mode = 0, content_offset = 0;