Skip to content

Commit 9e8c532

Browse files
jrngitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 6b01b67 commit 9e8c532

File tree

2 files changed

+59
-1
lines changed

2 files changed

+59
-1
lines changed

t/t9010-svn-fe.sh

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -580,6 +580,61 @@ test_expect_success 'property deltas supported' '
580580
test_cmp expect actual
581581
'
582582

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+
583638
test_expect_success 'deltas for typechange' '
584639
reinit_git &&
585640
cat >expect <<-\EOF &&

vcs-svn/svndump.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,10 @@ static void handle_node(void)
221221
}
222222
if (mark && type == REPO_MODE_DIR)
223223
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) {
225228
uint32_t mode = repo_modify_path(node_ctx.dst, 0, mark);
226229
if (!mode)
227230
die("invalid dump: path to be modified is missing");

0 commit comments

Comments
 (0)