@matheusbsbs / matheus-bagliano / commits / 9e8c532108
Fork 0

vcs-svn: Allow change nodes for root of tree (/)

It is not uncommon for a svn repository to include change records for properties at the top level of the tracked tree: Node-path: Node-kind: dir Node-action: change Prop-delta: true Prop-content-length: 43 Content-length: 43 K 10 svn:ignore V 11 build-area PROPS-END Unfortunately a recent svn-fe change (vcs-svn: More dump format sanity checks, 2010-11-19) causes such nodes to be rejected with the error message fatal: invalid dump: path to be modified is missing The repo_tree module does not keep a dirent for the root of the tree. Add a block to the dump parser to take care of this case. Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Jonathan Nieder committed Dec 6, 2010 at 16:19 UTC 9e8c532108b9078812f23c53a2df3509e7ce71bf
2 files changed +59 -1
t/t9010-svn-fe.sh
+55
@@ -580,6 +580,61 @@ test_expect_success 'property deltas supported' '
580 test_cmp expect actual
581 '
582
583 +test_expect_success 'properties on /' '
584 + reinit_git &&
585 + cat <<-\EOF >expect &&
586 + OBJID
587 + OBJID
588 + :000000 100644 OBJID OBJID A greeting
589 + EOF
590 + sed -e "s/X$//" <<-\EOF >changeroot.dump &&
591 + SVN-fs-dump-format-version: 3
592 +
593 + Revision-number: 1
594 + Prop-content-length: 10
595 + Content-length: 10
596 +
597 + PROPS-END
598 +
599 + Node-path: greeting
600 + Node-kind: file
601 + Node-action: add
602 + Text-content-length: 0
603 + Prop-content-length: 10
604 + Content-length: 10
605 +
606 + PROPS-END
607 +
608 + Revision-number: 2
609 + Prop-content-length: 10
610 + Content-length: 10
611 +
612 + PROPS-END
613 +
614 + Node-path: X
615 + Node-kind: dir
616 + Node-action: change
617 + Prop-delta: true
618 + Prop-content-length: 43
619 + Content-length: 43
620 +
621 + K 10
622 + svn:ignore
623 + V 11
624 + build-area
625 +
626 + PROPS-END
627 + EOF
628 + test-svn-fe changeroot.dump >stream &&
629 + git fast-import <stream &&
630 + {
631 + git rev-list HEAD |
632 + git diff-tree --root --always --stdin |
633 + sed "s/$_x40/OBJID/g"
634 + } >actual &&
635 + test_cmp expect actual
636 +'
637 +
638 test_expect_success 'deltas for typechange' '
639 reinit_git &&
640 cat >expect <<-\EOF &&
vcs-svn/svndump.c
+4 -1
@@ -221,7 +221,10 @@ static void handle_node(void)
221 }
222 if (mark && type == REPO_MODE_DIR)
223 die("invalid dump: directories cannot have text attached");
224 - if (node_ctx.action == NODEACT_CHANGE) {
224 + if (node_ctx.action == NODEACT_CHANGE && !~*node_ctx.dst) {
225 + if (type != REPO_MODE_DIR)
226 + die("invalid dump: root of tree is not a regular file");
227 + } else if (node_ctx.action == NODEACT_CHANGE) {
228 uint32_t mode = repo_modify_path(node_ctx.dst, 0, mark);
229 if (!mode)
230 die("invalid dump: path to be modified is missing");