summaryrefslogtreecommitdiff
path: root/vcs-svn/svndiff.c
diff options
context:
space:
mode:
authorJonathan Nieder <jrnieder@gmail.com>2010-10-13 09:38:01 (GMT)
committerJonathan Nieder <jrnieder@gmail.com>2011-03-28 04:02:05 (GMT)
commitef2ac77e9f8f4819f75cf52721567463e60a805c (patch)
treeb6abe02d4b4abd394106940dafcf9049af4c0317 /vcs-svn/svndiff.c
parentfc4ae43b2cbd53da6ac2a0047fb4e53175921696 (diff)
downloadgit-ef2ac77e9f8f4819f75cf52721567463e60a805c.zip
git-ef2ac77e9f8f4819f75cf52721567463e60a805c.tar.gz
git-ef2ac77e9f8f4819f75cf52721567463e60a805c.tar.bz2
vcs-svn: read instructions from deltas
Buffer the instruction section upon encountering it for later interpretation. An alternative design would involve parsing the instructions at this point and buffering them in some processed form. Using the unprocessed form is simpler. Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Acked-by: Ramkumar Ramachandra <artagnon@gmail.com>
Diffstat (limited to 'vcs-svn/svndiff.c')
-rw-r--r--vcs-svn/svndiff.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/vcs-svn/svndiff.c b/vcs-svn/svndiff.c
index 175168f..8968fdb 100644
--- a/vcs-svn/svndiff.c
+++ b/vcs-svn/svndiff.c
@@ -25,13 +25,15 @@
#define VLI_BITS_PER_DIGIT 7
struct window {
+ struct strbuf instructions;
struct strbuf data;
};
-#define WINDOW_INIT { STRBUF_INIT }
+#define WINDOW_INIT { STRBUF_INIT, STRBUF_INIT }
static void window_release(struct window *ctx)
{
+ strbuf_release(&ctx->instructions);
strbuf_release(&ctx->data);
}
@@ -124,7 +126,8 @@ static int apply_one_window(struct line_buffer *delta, off_t *delta_len)
/* "source view" offset and length already handled; */
if (read_length(delta, &out_len, delta_len) ||
read_length(delta, &instructions_len, delta_len) ||
- read_length(delta, &data_len, delta_len))
+ read_length(delta, &data_len, delta_len) ||
+ read_chunk(delta, delta_len, &ctx.instructions, instructions_len))
goto error_out;
if (instructions_len) {
error("What do you think I am? A delta applier?");