Skip to content

Commit

Permalink
vcs-svn: Reject path nodes without Node-action
Browse files Browse the repository at this point in the history
It would be better to flag such errors and let the import proceed
anyway, but for now it is simpler not to worry about recovery
from such weird cases.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Jonathan Nieder authored and Junio C Hamano committed Nov 24, 2010
1 parent 1c7bb31 commit 414e569
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 2 deletions.
20 changes: 20 additions & 0 deletions t/t9010-svn-fe.sh
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,26 @@ test_expect_success 'directory with files' '
test_cmp hi directory/file2
'

test_expect_success 'node without action' '
cat >inaction.dump <<-\EOF &&
SVN-fs-dump-format-version: 3
Revision-number: 1
Prop-content-length: 10
Content-length: 10
PROPS-END
Node-path: directory
Node-kind: dir
Prop-content-length: 10
Content-length: 10
PROPS-END
EOF
test_must_fail test-svn-fe inaction.dump
'

test_expect_failure 'change file mode but keep old content' '
reinit_git &&
cat >expect <<-\EOF &&
Expand Down
7 changes: 5 additions & 2 deletions vcs-svn/svndump.c
Original file line number Diff line number Diff line change
Expand Up @@ -174,16 +174,19 @@ static void handle_node(void)

if (node_ctx.srcRev) {
repo_copy(node_ctx.srcRev, node_ctx.src, node_ctx.dst);
node_ctx.action = NODEACT_CHANGE;
if (node_ctx.action == NODEACT_ADD)
node_ctx.action = NODEACT_CHANGE;
}

if (mark && type == REPO_MODE_DIR)
die("invalid dump: directories cannot have text attached");

if (node_ctx.action == NODEACT_CHANGE)
node_ctx.type = repo_modify_path(node_ctx.dst, 0, mark);
else /* Node-action: add */
else if (node_ctx.action == NODEACT_ADD)
repo_add(node_ctx.dst, type, mark);
else
die("invalid dump: Node-path block lacks Node-action");

if (have_props) {
const uint32_t old_mode = node_ctx.type;
Expand Down

0 comments on commit 414e569

Please sign in to comment.