CodingGuidelines: do not ==/!= compare with 0 or '\0' or NULL
[git.git] / t / t9010-svn-fe.sh
blobc90fdc5c8940164c6bf0eacdf9f7ac2e3b0e02ec
1 #!/bin/sh
3 test_description='check svn dumpfile importer'
5 . ./test-lib.sh
7 if test_have_prereq !PIPE
8 then
9 skip_all="svn dumpfile importer testing requires the PIPE prerequisite"
10 test_done
13 reinit_git () {
14 rm -fr .git &&
15 rm -f stream backflow &&
16 git init &&
17 mkfifo stream backflow
20 try_dump () {
21 input=$1 &&
22 maybe_fail_svnfe=${2:+test_$2} &&
23 maybe_fail_fi=${3:+test_$3} &&
26 $maybe_fail_svnfe test-svn-fe "$input" >stream 3<backflow &
27 } &&
28 $maybe_fail_fi git fast-import --cat-blob-fd=3 <stream 3>backflow &&
29 wait $!
32 properties () {
33 while test "$#" -ne 0
35 property="$1" &&
36 value="$2" &&
37 printf "%s\n" "K ${#property}" &&
38 printf "%s\n" "$property" &&
39 printf "%s\n" "V ${#value}" &&
40 printf "%s\n" "$value" &&
41 shift 2 ||
42 return 1
43 done
46 text_no_props () {
47 text="$1
48 " &&
49 printf "%s\n" "Prop-content-length: 10" &&
50 printf "%s\n" "Text-content-length: ${#text}" &&
51 printf "%s\n" "Content-length: $((${#text} + 10))" &&
52 printf "%s\n" "" "PROPS-END" &&
53 printf "%s\n" "$text"
56 test_expect_success 'empty dump' '
57 reinit_git &&
58 echo "SVN-fs-dump-format-version: 2" >input &&
59 try_dump input
62 test_expect_success 'v4 dumps not supported' '
63 reinit_git &&
64 echo "SVN-fs-dump-format-version: 4" >v4.dump &&
65 try_dump v4.dump must_fail
68 test_expect_failure 'empty revision' '
69 reinit_git &&
70 printf "rev <nobody, nobody@local>: %s\n" "" "" >expect &&
71 cat >emptyrev.dump <<-\EOF &&
72 SVN-fs-dump-format-version: 3
74 Revision-number: 1
75 Prop-content-length: 0
76 Content-length: 0
78 Revision-number: 2
79 Prop-content-length: 0
80 Content-length: 0
82 EOF
83 try_dump emptyrev.dump &&
84 git log -p --format="rev <%an, %ae>: %s" HEAD >actual &&
85 test_cmp expect actual
88 test_expect_success 'empty properties' '
89 reinit_git &&
90 printf "rev <nobody, nobody@local>: %s\n" "" "" >expect &&
91 cat >emptyprop.dump <<-\EOF &&
92 SVN-fs-dump-format-version: 3
94 Revision-number: 1
95 Prop-content-length: 10
96 Content-length: 10
98 PROPS-END
100 Revision-number: 2
101 Prop-content-length: 10
102 Content-length: 10
104 PROPS-END
106 try_dump emptyprop.dump &&
107 git log -p --format="rev <%an, %ae>: %s" HEAD >actual &&
108 test_cmp expect actual
111 test_expect_success 'author name and commit message' '
112 reinit_git &&
113 echo "<author@example.com, author@example.com@local>" >expect.author &&
114 cat >message <<-\EOF &&
115 A concise summary of the change
117 A detailed description of the change, why it is needed, what
118 was broken and why applying this is the best course of action.
120 * file.c
121 Details pertaining to an individual file.
124 properties \
125 svn:author author@example.com \
126 svn:log "$(cat message)" &&
127 echo PROPS-END
128 } >props &&
130 echo "SVN-fs-dump-format-version: 3" &&
131 echo &&
132 echo "Revision-number: 1" &&
133 echo Prop-content-length: $(wc -c <props) &&
134 echo Content-length: $(wc -c <props) &&
135 echo &&
136 cat props
137 } >log.dump &&
138 try_dump log.dump &&
139 git log -p --format="%B" HEAD >actual.log &&
140 git log --format="<%an, %ae>" >actual.author &&
141 test_cmp message actual.log &&
142 test_cmp expect.author actual.author
145 test_expect_success 'unsupported properties are ignored' '
146 reinit_git &&
147 echo author >expect &&
148 cat >extraprop.dump <<-\EOF &&
149 SVN-fs-dump-format-version: 3
151 Revision-number: 1
152 Prop-content-length: 56
153 Content-length: 56
156 nonsense
159 K 10
160 svn:author
162 author
163 PROPS-END
165 try_dump extraprop.dump &&
166 git log -p --format=%an HEAD >actual &&
167 test_cmp expect actual
170 test_expect_failure 'timestamp and empty file' '
171 echo author@example.com >expect.author &&
172 echo 1999-01-01 >expect.date &&
173 echo file >expect.files &&
174 reinit_git &&
176 properties \
177 svn:author author@example.com \
178 svn:date "1999-01-01T00:01:002.000000Z" \
179 svn:log "add empty file" &&
180 echo PROPS-END
181 } >props &&
183 cat <<-EOF &&
184 SVN-fs-dump-format-version: 3
186 Revision-number: 1
188 echo Prop-content-length: $(wc -c <props) &&
189 echo Content-length: $(wc -c <props) &&
190 echo &&
191 cat props &&
192 cat <<-\EOF
194 Node-path: empty-file
195 Node-kind: file
196 Node-action: add
197 Content-length: 0
200 } >emptyfile.dump &&
201 try_dump emptyfile.dump &&
202 git log --format=%an HEAD >actual.author &&
203 git log --date=short --format=%ad HEAD >actual.date &&
204 git ls-tree -r --name-only HEAD >actual.files &&
205 test_cmp expect.author actual.author &&
206 test_cmp expect.date actual.date &&
207 test_cmp expect.files actual.files &&
208 git checkout HEAD empty-file &&
209 test_must_be_empty file
212 test_expect_success 'directory with files' '
213 reinit_git &&
214 printf "%s\n" directory/file1 directory/file2 >expect.files &&
215 echo hi >hi &&
216 echo hello >hello &&
218 properties \
219 svn:author author@example.com \
220 svn:date "1999-02-01T00:01:002.000000Z" \
221 svn:log "add directory with some files in it" &&
222 echo PROPS-END
223 } >props &&
225 cat <<-EOF &&
226 SVN-fs-dump-format-version: 3
228 Revision-number: 1
230 echo Prop-content-length: $(wc -c <props) &&
231 echo Content-length: $(wc -c <props) &&
232 echo &&
233 cat props &&
234 cat <<-\EOF &&
236 Node-path: directory
237 Node-kind: dir
238 Node-action: add
239 Prop-content-length: 10
240 Content-length: 10
242 PROPS-END
244 Node-path: directory/file1
245 Node-kind: file
246 Node-action: add
248 text_no_props hello &&
249 cat <<-\EOF &&
250 Node-path: directory/file2
251 Node-kind: file
252 Node-action: add
254 text_no_props hi
255 } >directory.dump &&
256 try_dump directory.dump &&
258 git ls-tree -r --name-only HEAD >actual.files &&
259 git checkout HEAD directory &&
260 test_cmp expect.files actual.files &&
261 test_cmp hello directory/file1 &&
262 test_cmp hi directory/file2
265 test_expect_success 'branch name with backslash' '
266 reinit_git &&
267 sort <<-\EOF >expect.branch-files &&
268 trunk/file1
269 trunk/file2
270 "branches/UpdateFOPto094\\/file1"
271 "branches/UpdateFOPto094\\/file2"
274 echo hi >hi &&
275 echo hello >hello &&
277 properties \
278 svn:author author@example.com \
279 svn:date "1999-02-02T00:01:02.000000Z" \
280 svn:log "add directory with some files in it" &&
281 echo PROPS-END
282 } >props.setup &&
284 properties \
285 svn:author brancher@example.com \
286 svn:date "2007-12-06T21:38:34.000000Z" \
287 svn:log "Updating fop to .94 and adjust fo-stylesheets" &&
288 echo PROPS-END
289 } >props.branch &&
291 cat <<-EOF &&
292 SVN-fs-dump-format-version: 3
294 Revision-number: 1
296 echo Prop-content-length: $(wc -c <props.setup) &&
297 echo Content-length: $(wc -c <props.setup) &&
298 echo &&
299 cat props.setup &&
300 cat <<-\EOF &&
302 Node-path: trunk
303 Node-kind: dir
304 Node-action: add
305 Prop-content-length: 10
306 Content-length: 10
308 PROPS-END
310 Node-path: branches
311 Node-kind: dir
312 Node-action: add
313 Prop-content-length: 10
314 Content-length: 10
316 PROPS-END
318 Node-path: trunk/file1
319 Node-kind: file
320 Node-action: add
322 text_no_props hello &&
323 cat <<-\EOF &&
324 Node-path: trunk/file2
325 Node-kind: file
326 Node-action: add
328 text_no_props hi &&
329 cat <<-\EOF &&
331 Revision-number: 2
333 echo Prop-content-length: $(wc -c <props.branch) &&
334 echo Content-length: $(wc -c <props.branch) &&
335 echo &&
336 cat props.branch &&
337 cat <<-\EOF
339 Node-path: branches/UpdateFOPto094\
340 Node-kind: dir
341 Node-action: add
342 Node-copyfrom-rev: 1
343 Node-copyfrom-path: trunk
345 Node-kind: dir
346 Node-action: add
347 Prop-content-length: 34
348 Content-length: 34
350 K 13
351 svn:mergeinfo
354 PROPS-END
356 } >branch.dump &&
357 try_dump branch.dump &&
359 git ls-tree -r --name-only HEAD |
360 sort >actual.branch-files &&
361 test_cmp expect.branch-files actual.branch-files
364 test_expect_success 'node without action' '
365 reinit_git &&
366 cat >inaction.dump <<-\EOF &&
367 SVN-fs-dump-format-version: 3
369 Revision-number: 1
370 Prop-content-length: 10
371 Content-length: 10
373 PROPS-END
375 Node-path: directory
376 Node-kind: dir
377 Prop-content-length: 10
378 Content-length: 10
380 PROPS-END
382 try_dump inaction.dump must_fail
385 test_expect_success 'action: add node without text' '
386 reinit_git &&
387 cat >textless.dump <<-\EOF &&
388 SVN-fs-dump-format-version: 3
390 Revision-number: 1
391 Prop-content-length: 10
392 Content-length: 10
394 PROPS-END
396 Node-path: textless
397 Node-kind: file
398 Node-action: add
399 Prop-content-length: 10
400 Content-length: 10
402 PROPS-END
404 try_dump textless.dump must_fail
407 test_expect_failure 'change file mode but keep old content' '
408 reinit_git &&
409 cat >expect <<-\EOF &&
410 OBJID
411 :120000 100644 OBJID OBJID T greeting
412 OBJID
413 :100644 120000 OBJID OBJID T greeting
414 OBJID
415 :000000 100644 OBJID OBJID A greeting
417 echo "link hello" >expect.blob &&
418 echo hello >hello &&
419 cat >filemode.dump <<-\EOF &&
420 SVN-fs-dump-format-version: 3
422 Revision-number: 1
423 Prop-content-length: 10
424 Content-length: 10
426 PROPS-END
428 Node-path: greeting
429 Node-kind: file
430 Node-action: add
431 Prop-content-length: 10
432 Text-content-length: 11
433 Content-length: 21
435 PROPS-END
436 link hello
438 Revision-number: 2
439 Prop-content-length: 10
440 Content-length: 10
442 PROPS-END
444 Node-path: greeting
445 Node-kind: file
446 Node-action: change
447 Prop-content-length: 33
448 Content-length: 33
450 K 11
451 svn:special
454 PROPS-END
456 Revision-number: 3
457 Prop-content-length: 10
458 Content-length: 10
460 PROPS-END
462 Node-path: greeting
463 Node-kind: file
464 Node-action: change
465 Prop-content-length: 10
466 Content-length: 10
468 PROPS-END
470 try_dump filemode.dump &&
472 git rev-list HEAD |
473 git diff-tree --root --stdin |
474 sed "s/$OID_REGEX/OBJID/g"
475 } >actual &&
476 git show HEAD:greeting >actual.blob &&
477 git show HEAD^:greeting >actual.target &&
478 test_cmp expect actual &&
479 test_cmp expect.blob actual.blob &&
480 test_cmp hello actual.target
483 test_expect_success 'NUL in property value' '
484 reinit_git &&
485 echo "commit message" >expect.message &&
487 properties \
488 unimportant "something with a NUL (Q)" \
489 svn:log "commit message"&&
490 echo PROPS-END
492 q_to_nul >props &&
494 cat <<-\EOF &&
495 SVN-fs-dump-format-version: 3
497 Revision-number: 1
499 echo Prop-content-length: $(wc -c <props) &&
500 echo Content-length: $(wc -c <props) &&
501 echo &&
502 cat props
503 } >nulprop.dump &&
504 try_dump nulprop.dump &&
505 git diff-tree --always -s --format=%s HEAD >actual.message &&
506 test_cmp expect.message actual.message
509 test_expect_success 'NUL in log message, file content, and property name' '
510 # Caveat: svnadmin 1.6.16 (r1073529) truncates at \0 in the
511 # svn:specialQnotreally example.
512 reinit_git &&
513 cat >expect <<-\EOF &&
514 OBJID
515 :100644 100644 OBJID OBJID M greeting
516 OBJID
517 :000000 100644 OBJID OBJID A greeting
519 printf "\n%s\n" "something with an ASCII NUL (Q)" >expect.message &&
520 printf "%s\n" "helQo" >expect.hello1 &&
521 printf "%s\n" "link hello" >expect.hello2 &&
523 properties svn:log "something with an ASCII NUL (Q)" &&
524 echo PROPS-END
526 q_to_nul >props &&
528 q_to_nul <<-\EOF &&
529 SVN-fs-dump-format-version: 3
531 Revision-number: 1
532 Prop-content-length: 10
533 Content-length: 10
535 PROPS-END
537 Node-path: greeting
538 Node-kind: file
539 Node-action: add
540 Prop-content-length: 10
541 Text-content-length: 6
542 Content-length: 16
544 PROPS-END
545 helQo
547 Revision-number: 2
549 echo Prop-content-length: $(wc -c <props) &&
550 echo Content-length: $(wc -c <props) &&
551 echo &&
552 cat props &&
553 q_to_nul <<-\EOF
555 Node-path: greeting
556 Node-kind: file
557 Node-action: change
558 Prop-content-length: 43
559 Text-content-length: 11
560 Content-length: 54
562 K 21
563 svn:specialQnotreally
566 PROPS-END
567 link hello
569 } >8bitclean.dump &&
570 try_dump 8bitclean.dump &&
572 git rev-list HEAD |
573 git diff-tree --root --stdin |
574 sed "s/$OID_REGEX/OBJID/g"
575 } >actual &&
577 git cat-file commit HEAD | nul_to_q &&
578 echo
580 sed -ne "/^\$/,\$ p" >actual.message &&
581 git cat-file blob HEAD^:greeting | nul_to_q >actual.hello1 &&
582 git cat-file blob HEAD:greeting | nul_to_q >actual.hello2 &&
583 test_cmp expect actual &&
584 test_cmp expect.message actual.message &&
585 test_cmp expect.hello1 actual.hello1 &&
586 test_cmp expect.hello2 actual.hello2
589 test_expect_success 'change file mode and reiterate content' '
590 reinit_git &&
591 cat >expect <<-\EOF &&
592 OBJID
593 :120000 100644 OBJID OBJID T greeting
594 OBJID
595 :100644 120000 OBJID OBJID T greeting
596 OBJID
597 :000000 100644 OBJID OBJID A greeting
599 echo "link hello" >expect.blob &&
600 echo hello >hello &&
601 cat >filemode2.dump <<-\EOF &&
602 SVN-fs-dump-format-version: 3
604 Revision-number: 1
605 Prop-content-length: 10
606 Content-length: 10
608 PROPS-END
610 Node-path: greeting
611 Node-kind: file
612 Node-action: add
613 Prop-content-length: 10
614 Text-content-length: 11
615 Content-length: 21
617 PROPS-END
618 link hello
620 Revision-number: 2
621 Prop-content-length: 10
622 Content-length: 10
624 PROPS-END
626 Node-path: greeting
627 Node-kind: file
628 Node-action: change
629 Prop-content-length: 33
630 Text-content-length: 11
631 Content-length: 44
633 K 11
634 svn:special
637 PROPS-END
638 link hello
640 Revision-number: 3
641 Prop-content-length: 10
642 Content-length: 10
644 PROPS-END
646 Node-path: greeting
647 Node-kind: file
648 Node-action: change
649 Prop-content-length: 10
650 Text-content-length: 11
651 Content-length: 21
653 PROPS-END
654 link hello
656 try_dump filemode2.dump &&
658 git rev-list HEAD |
659 git diff-tree --root --stdin |
660 sed "s/$OID_REGEX/OBJID/g"
661 } >actual &&
662 git show HEAD:greeting >actual.blob &&
663 git show HEAD^:greeting >actual.target &&
664 test_cmp expect actual &&
665 test_cmp expect.blob actual.blob &&
666 test_cmp hello actual.target
669 test_expect_success 'deltas supported' '
670 reinit_git &&
672 # (old) h + (inline) ello + (old) \n
673 printf "SVNQ%b%b%s" "Q\003\006\005\004" "\001Q\0204\001\002" "ello" |
674 q_to_nul
675 } >delta &&
677 properties \
678 svn:author author@example.com \
679 svn:date "1999-01-05T00:01:002.000000Z" \
680 svn:log "add greeting" &&
681 echo PROPS-END
682 } >props &&
684 properties \
685 svn:author author@example.com \
686 svn:date "1999-01-06T00:01:002.000000Z" \
687 svn:log "change it" &&
688 echo PROPS-END
689 } >props2 &&
691 echo SVN-fs-dump-format-version: 3 &&
692 echo &&
693 echo Revision-number: 1 &&
694 echo Prop-content-length: $(wc -c <props) &&
695 echo Content-length: $(wc -c <props) &&
696 echo &&
697 cat props &&
698 cat <<-\EOF &&
700 Node-path: hello
701 Node-kind: file
702 Node-action: add
703 Prop-content-length: 10
704 Text-content-length: 3
705 Content-length: 13
707 PROPS-END
711 echo Revision-number: 2 &&
712 echo Prop-content-length: $(wc -c <props2) &&
713 echo Content-length: $(wc -c <props2) &&
714 echo &&
715 cat props2 &&
716 cat <<-\EOF &&
718 Node-path: hello
719 Node-kind: file
720 Node-action: change
721 Text-delta: true
722 Prop-content-length: 10
724 echo Text-content-length: $(wc -c <delta) &&
725 echo Content-length: $((10 + $(wc -c <delta))) &&
726 echo &&
727 echo PROPS-END &&
728 cat delta
729 } >delta.dump &&
730 try_dump delta.dump
733 test_expect_success 'property deltas supported' '
734 reinit_git &&
735 cat >expect <<-\EOF &&
736 OBJID
737 :100755 100644 OBJID OBJID M script.sh
740 properties \
741 svn:author author@example.com \
742 svn:date "1999-03-06T00:01:002.000000Z" \
743 svn:log "make an executable, or chmod -x it" &&
744 echo PROPS-END
745 } >revprops &&
747 echo SVN-fs-dump-format-version: 3 &&
748 echo &&
749 echo Revision-number: 1 &&
750 echo Prop-content-length: $(wc -c <revprops) &&
751 echo Content-length: $(wc -c <revprops) &&
752 echo &&
753 cat revprops &&
754 echo &&
755 cat <<-\EOF &&
756 Node-path: script.sh
757 Node-kind: file
758 Node-action: add
759 Text-content-length: 0
760 Prop-content-length: 39
761 Content-length: 39
763 K 14
764 svn:executable
766 true
767 PROPS-END
770 echo Revision-number: 2 &&
771 echo Prop-content-length: $(wc -c <revprops) &&
772 echo Content-length: $(wc -c <revprops) &&
773 echo &&
774 cat revprops &&
775 echo &&
776 cat <<-\EOF
777 Node-path: script.sh
778 Node-kind: file
779 Node-action: change
780 Prop-delta: true
781 Prop-content-length: 30
782 Content-length: 30
784 D 14
785 svn:executable
786 PROPS-END
788 } >propdelta.dump &&
789 try_dump propdelta.dump &&
791 git rev-list HEAD |
792 git diff-tree --stdin |
793 sed "s/$OID_REGEX/OBJID/g"
794 } >actual &&
795 test_cmp expect actual
798 test_expect_success 'properties on /' '
799 reinit_git &&
800 cat <<-\EOF >expect &&
801 OBJID
802 OBJID
803 :000000 100644 OBJID OBJID A greeting
805 sed -e "s/X$//" <<-\EOF >changeroot.dump &&
806 SVN-fs-dump-format-version: 3
808 Revision-number: 1
809 Prop-content-length: 10
810 Content-length: 10
812 PROPS-END
814 Node-path: greeting
815 Node-kind: file
816 Node-action: add
817 Text-content-length: 0
818 Prop-content-length: 10
819 Content-length: 10
821 PROPS-END
823 Revision-number: 2
824 Prop-content-length: 10
825 Content-length: 10
827 PROPS-END
829 Node-path: X
830 Node-kind: dir
831 Node-action: change
832 Prop-delta: true
833 Prop-content-length: 43
834 Content-length: 43
836 K 10
837 svn:ignore
838 V 11
839 build-area
841 PROPS-END
843 try_dump changeroot.dump &&
845 git rev-list HEAD |
846 git diff-tree --root --always --stdin |
847 sed "s/$OID_REGEX/OBJID/g"
848 } >actual &&
849 test_cmp expect actual
852 test_expect_success 'deltas for typechange' '
853 reinit_git &&
854 cat >expect <<-\EOF &&
855 OBJID
856 :120000 100644 OBJID OBJID T test-file
857 OBJID
858 :100755 120000 OBJID OBJID T test-file
859 OBJID
860 :000000 100755 OBJID OBJID A test-file
862 cat >deleteprop.dump <<-\EOF &&
863 SVN-fs-dump-format-version: 3
865 Revision-number: 1
866 Prop-content-length: 10
867 Content-length: 10
869 PROPS-END
871 Node-path: test-file
872 Node-kind: file
873 Node-action: add
874 Prop-delta: true
875 Prop-content-length: 35
876 Text-content-length: 17
877 Content-length: 52
879 K 14
880 svn:executable
883 PROPS-END
884 link testing 123
886 Revision-number: 2
887 Prop-content-length: 10
888 Content-length: 10
890 PROPS-END
892 Node-path: test-file
893 Node-kind: file
894 Node-action: change
895 Prop-delta: true
896 Prop-content-length: 53
897 Text-content-length: 17
898 Content-length: 70
900 K 11
901 svn:special
904 D 14
905 svn:executable
906 PROPS-END
907 link testing 231
909 Revision-number: 3
910 Prop-content-length: 10
911 Content-length: 10
913 PROPS-END
915 Node-path: test-file
916 Node-kind: file
917 Node-action: change
918 Prop-delta: true
919 Prop-content-length: 27
920 Text-content-length: 17
921 Content-length: 44
923 D 11
924 svn:special
925 PROPS-END
926 link testing 321
928 try_dump deleteprop.dump &&
930 git rev-list HEAD |
931 git diff-tree --root --stdin |
932 sed "s/$OID_REGEX/OBJID/g"
933 } >actual &&
934 test_cmp expect actual
937 test_expect_success 'deltas need not consume the whole preimage' '
938 reinit_git &&
939 cat >expect <<-\EOF &&
940 OBJID
941 :120000 100644 OBJID OBJID T postimage
942 OBJID
943 :100644 120000 OBJID OBJID T postimage
944 OBJID
945 :000000 100644 OBJID OBJID A postimage
947 echo "first preimage" >expect.1 &&
948 printf target >expect.2 &&
949 printf lnk >expect.3 &&
951 printf "SVNQ%b%b%b" "QQ\017\001\017" "\0217" "first preimage\n" |
952 q_to_nul
953 } >delta.1 &&
955 properties svn:special "*" &&
956 echo PROPS-END
957 } >symlink.props &&
959 printf "SVNQ%b%b%b" "Q\002\013\004\012" "\0201\001\001\0211" "lnk target" |
960 q_to_nul
961 } >delta.2 &&
963 printf "SVNQ%b%b" "Q\004\003\004Q" "\001Q\002\002" |
964 q_to_nul
965 } >delta.3 &&
967 cat <<-\EOF &&
968 SVN-fs-dump-format-version: 3
970 Revision-number: 1
971 Prop-content-length: 10
972 Content-length: 10
974 PROPS-END
976 Node-path: postimage
977 Node-kind: file
978 Node-action: add
979 Text-delta: true
980 Prop-content-length: 10
982 echo Text-content-length: $(wc -c <delta.1) &&
983 echo Content-length: $((10 + $(wc -c <delta.1))) &&
984 echo &&
985 echo PROPS-END &&
986 cat delta.1 &&
987 cat <<-\EOF &&
989 Revision-number: 2
990 Prop-content-length: 10
991 Content-length: 10
993 PROPS-END
995 Node-path: postimage
996 Node-kind: file
997 Node-action: change
998 Text-delta: true
1000 echo Prop-content-length: $(wc -c <symlink.props) &&
1001 echo Text-content-length: $(wc -c <delta.2) &&
1002 echo Content-length: $(($(wc -c <symlink.props) + $(wc -c <delta.2))) &&
1003 echo &&
1004 cat symlink.props &&
1005 cat delta.2 &&
1006 cat <<-\EOF &&
1008 Revision-number: 3
1009 Prop-content-length: 10
1010 Content-length: 10
1012 PROPS-END
1014 Node-path: postimage
1015 Node-kind: file
1016 Node-action: change
1017 Text-delta: true
1018 Prop-content-length: 10
1020 echo Text-content-length: $(wc -c <delta.3) &&
1021 echo Content-length: $((10 + $(wc -c <delta.3))) &&
1022 echo &&
1023 echo PROPS-END &&
1024 cat delta.3 &&
1025 echo
1026 } >deltapartial.dump &&
1027 try_dump deltapartial.dump &&
1029 git rev-list HEAD |
1030 git diff-tree --root --stdin |
1031 sed "s/$OID_REGEX/OBJID/g"
1032 } >actual &&
1033 test_cmp expect actual &&
1034 git show HEAD:postimage >actual.3 &&
1035 git show HEAD^:postimage >actual.2 &&
1036 git show HEAD^^:postimage >actual.1 &&
1037 test_cmp expect.1 actual.1 &&
1038 test_cmp expect.2 actual.2 &&
1039 test_cmp expect.3 actual.3
1042 test_expect_success 'no hang for delta trying to read past end of preimage' '
1043 reinit_git &&
1045 # COPY 1
1046 printf "SVNQ%b%b" "Q\001\001\002Q" "\001Q" |
1047 q_to_nul
1048 } >greedy.delta &&
1050 cat <<-\EOF &&
1051 SVN-fs-dump-format-version: 3
1053 Revision-number: 1
1054 Prop-content-length: 10
1055 Content-length: 10
1057 PROPS-END
1059 Node-path: bootstrap
1060 Node-kind: file
1061 Node-action: add
1062 Text-delta: true
1063 Prop-content-length: 10
1065 echo Text-content-length: $(wc -c <greedy.delta) &&
1066 echo Content-length: $((10 + $(wc -c <greedy.delta))) &&
1067 echo &&
1068 echo PROPS-END &&
1069 cat greedy.delta &&
1070 echo
1071 } >greedydelta.dump &&
1072 try_dump greedydelta.dump must_fail might_fail
1075 test_expect_success 'set up svn repo' '
1076 svnconf=$PWD/svnconf &&
1077 mkdir -p "$svnconf" &&
1080 svnadmin -h >/dev/null 2>&1 &&
1081 svnadmin create simple-svn &&
1082 svnadmin load simple-svn <"$TEST_DIRECTORY/t9135/svn.dump" &&
1083 svn export --config-dir "$svnconf" "file://$PWD/simple-svn" simple-svnco
1084 then
1085 test_set_prereq SVNREPO
1089 test_expect_success SVNREPO 't9135/svn.dump' '
1090 mkdir -p simple-git &&
1092 cd simple-git &&
1093 reinit_git &&
1094 try_dump "$TEST_DIRECTORY/t9135/svn.dump"
1095 ) &&
1097 cd simple-svnco &&
1098 git init &&
1099 git add . &&
1100 git fetch ../simple-git master &&
1101 git diff --exit-code FETCH_HEAD
1105 test_done