summaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
authorJonathan Nieder <jrnieder@gmail.com>2011-01-03 04:54:58 +0100
committerJonathan Nieder <jrnieder@gmail.com>2011-03-28 03:23:32 +0200
commit9d2f5ddfe56fcc228a36dd079f0897e0f474eb4e (patch)
treeac08de7bff81eb1d33395d8cb1b2998a60475afb /Makefile
parentMakefile: list one vcs-svn/xdiff object or header per line (diff)
downloadgit-9d2f5ddfe56fcc228a36dd079f0897e0f474eb4e.tar.xz
git-9d2f5ddfe56fcc228a36dd079f0897e0f474eb4e.zip
vcs-svn: learn to maintain a sliding view of a file
Each section of a Subversion-format delta only requires examining (and keeping in random-access memory) a small portion of the preimage. At any moment, this portion starts at a certain file offset and has a well-defined length, and as the delta is applied, the portion advances from the beginning to the end of the preimage. Add a move_window function to keep track of this view into the preimage. You can use it like this: buffer_init(f, NULL); struct sliding_view window = SLIDING_VIEW_INIT(f); move_window(&window, 3, 7); /* (1) */ move_window(&window, 5, 5); /* (2) */ move_window(&window, 12, 2); /* (3) */ strbuf_release(&window.buf); buffer_deinit(f); The data structure is called sliding_view instead of _window to prevent confusion with svndiff0 Windows. In this example, (1) reads 10 bytes and discards the first 3; (2) discards the first 2, which are not needed any more; and (3) skips 2 bytes and reads 2 new bytes to work with. When move_window returns, the file position indicator is at position window->off + window->width and the data from positions window->off to the current file position are stored in window->buf. This function performs only sequential access from the input file and never seeks, so it can be safely used on pipes and sockets. On end-of-file, move_window silently reads less than the caller requested. On other errors, it prints a message and returns -1. Helped-by: David Barr <david.barr@cordelta.com> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile2
1 files changed, 2 insertions, 0 deletions
diff --git a/Makefile b/Makefile
index dd1af362c7..5cd141d5af 100644
--- a/Makefile
+++ b/Makefile
@@ -1851,6 +1851,7 @@ XDIFF_OBJS += xdiff/xpatience.o
VCSSVN_OBJS += vcs-svn/string_pool.o
VCSSVN_OBJS += vcs-svn/line_buffer.o
+VCSSVN_OBJS += vcs-svn/sliding_window.o
VCSSVN_OBJS += vcs-svn/repo_tree.o
VCSSVN_OBJS += vcs-svn/fast_export.o
VCSSVN_OBJS += vcs-svn/svndump.o
@@ -1993,6 +1994,7 @@ VCSSVN_H += vcs-svn/obj_pool.h
VCSSVN_H += vcs-svn/trp.h
VCSSVN_H += vcs-svn/string_pool.h
VCSSVN_H += vcs-svn/line_buffer.h
+VCSSVN_H += vcs-svn/sliding_window.h
VCSSVN_H += vcs-svn/repo_tree.h
VCSSVN_H += vcs-svn/fast_export.h
VCSSVN_H += vcs-svn/svndump.h