summaryrefslogtreecommitdiff
path: root/t/t9011-svn-da.sh
diff options
context:
space:
mode:
authorLibravatar Jonathan Nieder <jrnieder@gmail.com>2010-10-13 04:35:59 -0500
committerLibravatar Jonathan Nieder <jrnieder@gmail.com>2011-03-27 22:51:00 -0500
commitfc4ae43b2cbd53da6ac2a0047fb4e53175921696 (patch)
treea957c8604baf066e5cc5eb0c8f3f085ee1d10bcf /t/t9011-svn-da.sh
parentvcs-svn: read the preimage when applying deltas (diff)
downloadtgif-fc4ae43b2cbd53da6ac2a0047fb4e53175921696.tar.xz
vcs-svn: read inline data from deltas
Each window of an svndiff0-format delta includes a section for novel text to be copied to the postimage (in the order it appears in the window, possibly interspersed with other data). Slurp in this data when encountering it. It is not actually necessary to do so --- it would be just as easy to copy from delta to output as part of interpreting the relevant instructions --- but this way, the code that interprets svndiff0 instructions can proceed very quickly because it does not require I/O. Subversion's svndiff0 parser rejects deltas that do not consume all the novel text that was provided. Omit that check for now so we can test the new functionality right away, rather than waiting to learn instructions that consume data. Do check for truncated data sections. Subversion's parser rejects deltas that end in the middle of a declared novel-text section, so it should be safe for us to reject them, too. Improved-by: Ramkumar Ramachandra <artagnon@gmail.com> Improved-by: David Barr <david.barr@cordelta.com> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Acked-by: Ramkumar Ramachandra <artagnon@gmail.com>
Diffstat (limited to 't/t9011-svn-da.sh')
-rwxr-xr-xt/t9011-svn-da.sh12
1 files changed, 12 insertions, 0 deletions
diff --git a/t/t9011-svn-da.sh b/t/t9011-svn-da.sh
index 90b6058ab6..26a4a3694a 100755
--- a/t/t9011-svn-da.sh
+++ b/t/t9011-svn-da.sh
@@ -121,4 +121,16 @@ test_expect_success 'preimage view: reject truncated preimage' '
test_must_fail test-svn-fe -d preimage clear.longread 9
'
+test_expect_success 'inline data' '
+ printf "SVNQ%b%s%b%s" "QQQQ\003" "bar" "QQQQ\001" "x" |
+ q_to_nul >inline.clear &&
+ test-svn-fe -d preimage inline.clear 18 >actual &&
+ test_cmp empty actual
+'
+
+test_expect_success 'reject truncated inline data' '
+ printf "SVNQ%b%s" "QQQQ\003" "b" | q_to_nul >inline.trunc &&
+ test_must_fail test-svn-fe -d preimage inline.trunc 10
+'
+
test_done