aboutsummaryrefslogtreecommitdiff
path: root/t/t9011-svn-da.sh
diff options
context:
space:
mode:
authorJonathan Nieder <jrnieder@gmail.com>2010-12-25 05:11:32 -0600
committerJonathan Nieder <jrnieder@gmail.com>2011-03-27 22:41:38 -0500
commitddcc8c5b469d2564dbacd629a873e7703f2dbd83 (patch)
treebe76203eaed1f7e29a0c148dbaaae9b4b1156504 /t/t9011-svn-da.sh
parent896e4bfcec4f6b489aba2197f60a59bc7f45a8ac (diff)
downloadgit-ddcc8c5b469d2564dbacd629a873e7703f2dbd83.tar.gz
git-ddcc8c5b469d2564dbacd629a873e7703f2dbd83.tar.xz
vcs-svn: skeleton of an svn delta parser
A delta in the subversion delta (svndiff0) format consists of the magic bytes SVN\0 followed by a sequence of windows of a certain well specified format (starting with five integers). Add an svndiff0_apply function and test-svn-fe -d commandline tool to parse such a delta in the special case of not including any windows. Later patches will add features to turn this into a fully functional delta applier for svn-fe to use to parse the streams produced by "svnrdump dump" and "svnadmin dump --deltas". The content of symlinks starts with the word "link " in Subversion's worldview, so we need to be able to prepend that text to input for the sake of delta application. So initialization of the input state of the delta preimage is left to the calling program, giving callers a chance to seed the buffer with text of their choice. Improved-by: Ramkumar Ramachandra <artagnon@gmail.com> Improved-by: David Barr <david.barr@cordelta.com> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Diffstat (limited to 't/t9011-svn-da.sh')
-rwxr-xr-xt/t9011-svn-da.sh35
1 files changed, 35 insertions, 0 deletions
diff --git a/t/t9011-svn-da.sh b/t/t9011-svn-da.sh
new file mode 100755
index 000000000..ee0c1e208
--- /dev/null
+++ b/t/t9011-svn-da.sh
@@ -0,0 +1,35 @@
+#!/bin/sh
+
+test_description='test parsing of svndiff0 files
+
+Using the "test-svn-fe -d" helper, check that svn-fe correctly
+interprets deltas using various facilities (some from the spec,
+some only learned from practice).
+'
+. ./test-lib.sh
+
+>empty
+printf foo >preimage
+
+test_expect_success 'reject empty delta' '
+ test_must_fail test-svn-fe -d preimage empty 0
+'
+
+test_expect_success 'delta can empty file' '
+ printf "SVNQ" | q_to_nul >clear.delta &&
+ test-svn-fe -d preimage clear.delta 4 >actual &&
+ test_cmp empty actual
+'
+
+test_expect_success 'reject svndiff2' '
+ printf "SVN\002" >bad.filetype &&
+ test_must_fail test-svn-fe -d preimage bad.filetype 4
+'
+
+test_expect_failure 'one-window empty delta' '
+ printf "SVNQ%s" "QQQQQ" | q_to_nul >clear.onewindow &&
+ test-svn-fe -d preimage clear.onewindow 9 >actual &&
+ test_cmp empty actual
+'
+
+test_done