path: root/vcs-svn
diff options
authorJonathan Nieder <>2010-10-13 09:30:37 (GMT)
committerJonathan Nieder <>2011-03-28 03:50:01 (GMT)
commitbcd254621f9a98794cdc32906db10af7135824c4 (patch)
treedd511d4436cdb4e0c4941654d8cfd96367f1ed72 /vcs-svn
parent252712111fad127db365e3dd764309fe5658679a (diff)
vcs-svn: read the preimage when applying deltas
The source view offset heading each svndiff0 window represents a number of bytes past the beginning of the preimage. Together with the source view length, it dictates to the delta applier what portion of the preimage instructions will refer to. Read that portion right away using the sliding window code. Maybe some day we will use mmap to read data more lazily. Subversion's implementation tolerates source view offsets pointing past the end of the preimage file but we do not, for simplicity. This does not teach the delta applier to read instructions or copy data from the source view. Deltas that could produce nonempty output will still be rejected. Improved-by: Ramkumar Ramachandra <> Improved-by: David Barr <> Signed-off-by: Jonathan Nieder <> Acked-by: Ramkumar Ramachandra <>
Diffstat (limited to 'vcs-svn')
1 files changed, 2 insertions, 0 deletions
diff --git a/vcs-svn/svndiff.c b/vcs-svn/svndiff.c
index 249efb6..b7c2c8b 100644
--- a/vcs-svn/svndiff.c
+++ b/vcs-svn/svndiff.c
@@ -4,6 +4,7 @@
#include "git-compat-util.h"
+#include "sliding_window.h"
#include "line_buffer.h"
#include "svndiff.h"
@@ -127,6 +128,7 @@ int svndiff0_apply(struct line_buffer *delta, off_t delta_len,
if (read_offset(delta, &pre_off, &delta_len) ||
read_length(delta, &pre_len, &delta_len) ||
+ move_window(preimage, pre_off, pre_len) ||
apply_one_window(delta, &delta_len))
return -1;