3 test_description='check svn dumpfile importer'
17 printf "%s\n" "K ${#property}" &&
18 printf "%s\n" "$property" &&
19 printf "%s\n" "V ${#value}" &&
20 printf "%s\n" "$value" &&
29 printf "%s\n" "Prop-content-length: 10" &&
30 printf "%s\n" "Text-content-length: ${#text}" &&
31 printf "%s\n" "Content-length: $((${#text} + 10))" &&
32 printf "%s\n" "" "PROPS-END" &&
38 test_expect_success 'empty dump' '
40 echo "SVN-fs-dump-format-version: 2" >input &&
41 test-svn-fe input >stream &&
42 git fast-import <stream
45 test_expect_success 'v4 dumps not supported' '
47 echo "SVN-fs-dump-format-version: 4" >v4.dump &&
48 test_must_fail test-svn-fe v4.dump >stream &&
52 test_expect_failure 'empty revision' '
54 printf "rev <nobody, nobody@local>: %s\n" "" "" >expect &&
55 cat >emptyrev.dump <<-\EOF &&
56 SVN-fs-dump-format-version: 3
59 Prop-content-length: 0
63 Prop-content-length: 0
67 test-svn-fe emptyrev.dump >stream &&
68 git fast-import <stream &&
69 git log -p --format="rev <%an, %ae>: %s" HEAD >actual &&
70 test_cmp expect actual
73 test_expect_success 'empty properties' '
75 printf "rev <nobody, nobody@local>: %s\n" "" "" >expect &&
76 cat >emptyprop.dump <<-\EOF &&
77 SVN-fs-dump-format-version: 3
80 Prop-content-length: 10
86 Prop-content-length: 10
91 test-svn-fe emptyprop.dump >stream &&
92 git fast-import <stream &&
93 git log -p --format="rev <%an, %ae>: %s" HEAD >actual &&
94 test_cmp expect actual
97 test_expect_success 'author name and commit message' '
99 echo "<author@example.com, author@example.com@local>" >expect.author &&
100 cat >message <<-\EOF &&
101 A concise summary of the change
103 A detailed description of the change, why it is needed, what
104 was broken and why applying this is the best course of action.
107 Details pertaining to an individual file.
111 svn:author author@example.com \
112 svn:log "$(cat message)" &&
116 echo "SVN-fs-dump-format-version: 3" &&
118 echo "Revision-number: 1" &&
119 echo Prop-content-length: $(wc -c <props) &&
120 echo Content-length: $(wc -c <props) &&
124 test-svn-fe log.dump >stream &&
125 git fast-import <stream &&
126 git log -p --format="%B" HEAD >actual.log &&
127 git log --format="<%an, %ae>" >actual.author &&
128 test_cmp message actual.log &&
129 test_cmp expect.author actual.author
132 test_expect_success 'unsupported properties are ignored' '
134 echo author >expect &&
135 cat >extraprop.dump <<-\EOF &&
136 SVN-fs-dump-format-version: 3
139 Prop-content-length: 56
152 test-svn-fe extraprop.dump >stream &&
153 git fast-import <stream &&
154 git log -p --format=%an HEAD >actual &&
155 test_cmp expect actual
158 test_expect_failure 'timestamp and empty file' '
159 echo author@example.com >expect.author &&
160 echo 1999-01-01 >expect.date &&
161 echo file >expect.files &&
165 svn:author author@example.com \
166 svn:date "1999-01-01T00:01:002.000000Z" \
167 svn:log "add empty file" &&
172 SVN-fs-dump-format-version: 3
176 echo Prop-content-length: $(wc -c <props) &&
177 echo Content-length: $(wc -c <props) &&
182 Node-path: empty-file
189 test-svn-fe emptyfile.dump >stream &&
190 git fast-import <stream &&
191 git log --format=%an HEAD >actual.author &&
192 git log --date=short --format=%ad HEAD >actual.date &&
193 git ls-tree -r --name-only HEAD >actual.files &&
194 test_cmp expect.author actual.author &&
195 test_cmp expect.date actual.date &&
196 test_cmp expect.files actual.files &&
197 git checkout HEAD empty-file &&
201 test_expect_success 'directory with files' '
203 printf "%s\n" directory/file1 directory/file2 >expect.files &&
208 svn:author author@example.com \
209 svn:date "1999-02-01T00:01:002.000000Z" \
210 svn:log "add directory with some files in it" &&
215 SVN-fs-dump-format-version: 3
219 echo Prop-content-length: $(wc -c <props) &&
220 echo Content-length: $(wc -c <props) &&
228 Prop-content-length: 10
233 Node-path: directory/file1
237 text_no_props hello &&
239 Node-path: directory/file2
245 test-svn-fe directory.dump >stream &&
246 git fast-import <stream &&
248 git ls-tree -r --name-only HEAD >actual.files &&
249 git checkout HEAD directory &&
250 test_cmp expect.files actual.files &&
251 test_cmp hello directory/file1 &&
252 test_cmp hi directory/file2
255 test_expect_failure 'change file mode but keep old content' '
257 cat >expect <<-\EOF &&
259 :120000 100644 OBJID OBJID T greeting
261 :100644 120000 OBJID OBJID T greeting
263 :000000 100644 OBJID OBJID A greeting
265 echo "link hello" >expect.blob &&
267 cat >filemode.dump <<-\EOF &&
268 SVN-fs-dump-format-version: 3
271 Prop-content-length: 10
279 Prop-content-length: 10
280 Text-content-length: 11
287 Prop-content-length: 10
295 Prop-content-length: 33
305 Prop-content-length: 10
313 Prop-content-length: 10
318 test-svn-fe filemode.dump >stream &&
319 git fast-import <stream &&
322 git diff-tree --root --stdin |
323 sed "s/$_x40/OBJID/g"
325 git show HEAD:greeting >actual.blob &&
326 git show HEAD^:greeting >actual.target &&
327 test_cmp expect actual &&
328 test_cmp expect.blob actual.blob &&
329 test_cmp hello actual.target
332 test_expect_success 'change file mode and reiterate content' '
334 cat >expect <<-\EOF &&
336 :120000 100644 OBJID OBJID T greeting
338 :100644 120000 OBJID OBJID T greeting
340 :000000 100644 OBJID OBJID A greeting
342 echo "link hello" >expect.blob &&
344 cat >filemode.dump <<-\EOF &&
345 SVN-fs-dump-format-version: 3
348 Prop-content-length: 10
356 Prop-content-length: 10
357 Text-content-length: 11
364 Prop-content-length: 10
372 Prop-content-length: 33
373 Text-content-length: 11
384 Prop-content-length: 10
392 Prop-content-length: 10
393 Text-content-length: 11
399 test-svn-fe filemode.dump >stream &&
400 git fast-import <stream &&
403 git diff-tree --root --stdin |
404 sed "s/$_x40/OBJID/g"
406 git show HEAD:greeting >actual.blob &&
407 git show HEAD^:greeting >actual.target &&
408 test_cmp expect actual &&
409 test_cmp expect.blob actual.blob &&
410 test_cmp hello actual.target
413 test_expect_success 'deltas not supported' '
415 # (old) h + (inline) ello + (old) \n
416 printf "SVNQ%b%b%s" "Q\003\006\005\004" "\001Q\0204\001\002" "ello" |
421 svn:author author@example.com \
422 svn:date "1999-01-05T00:01:002.000000Z" \
423 svn:log "add greeting" &&
428 svn:author author@example.com \
429 svn:date "1999-01-06T00:01:002.000000Z" \
430 svn:log "change it" &&
434 echo SVN-fs-dump-format-version: 3 &&
436 echo Revision-number: 1 &&
437 echo Prop-content-length: $(wc -c <props) &&
438 echo Content-length: $(wc -c <props) &&
446 Prop-content-length: 10
447 Text-content-length: 3
454 echo Revision-number: 2 &&
455 echo Prop-content-length: $(wc -c <props2) &&
456 echo Content-length: $(wc -c <props2) &&
465 Prop-content-length: 10
467 echo Text-content-length: $(wc -c <delta) &&
468 echo Content-length: $((10 + $(wc -c <delta))) &&
473 test_must_fail test-svn-fe delta.dump
476 test_expect_success 'property deltas not supported' '
479 svn:author author@example.com \
480 svn:date "1999-03-06T00:01:002.000000Z" \
481 svn:log "make an executable, or chmod -x it" &&
485 echo SVN-fs-dump-format-version: 3 &&
487 echo Revision-number: 1 &&
488 echo Prop-content-length: $(wc -c <revprops) &&
489 echo Content-length: $(wc -c <revprops) &&
497 Text-content-length: 0
498 Prop-content-length: 39
508 echo Revision-number: 2 &&
509 echo Prop-content-length: $(wc -c <revprops) &&
510 echo Content-length: $(wc -c <revprops) &&
519 Prop-content-length: 30
527 test_must_fail test-svn-fe propdelta.dump
530 test_expect_success 't9135/svn.dump' '
531 svnadmin create simple-svn &&
532 svnadmin load simple-svn <"$TEST_DIRECTORY/t9135/svn.dump" &&
533 svn_cmd export "file://$PWD/simple-svn" simple-svnco &&
534 git init simple-git &&
535 test-svn-fe "$TEST_DIRECTORY/t9135/svn.dump" >simple.fe &&
538 git fast-import <../simple.fe
544 git fetch ../simple-git master &&
545 git diff --exit-code FETCH_HEAD