@matheusbsbs / matheus-bagliano / commits / 414e569e45
Fork 0

vcs-svn: Reject path nodes without Node-action

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>

Jonathan Nieder committed Nov 19, 2010 at 18:52 UTC 414e569e453a49171b1f3db613f88378324104e8
2 files changed +25 -2
t/t9010-svn-fe.sh
+20
@@ -252,6 +252,26 @@ test_expect_success 'directory with files' '
252 test_cmp hi directory/file2
253 '
254
255 +test_expect_success 'node without action' '
256 + cat >inaction.dump <<-\EOF &&
257 + SVN-fs-dump-format-version: 3
258 +
259 + Revision-number: 1
260 + Prop-content-length: 10
261 + Content-length: 10
262 +
263 + PROPS-END
264 +
265 + Node-path: directory
266 + Node-kind: dir
267 + Prop-content-length: 10
268 + Content-length: 10
269 +
270 + PROPS-END
271 + EOF
272 + test_must_fail test-svn-fe inaction.dump
273 +'
274 +
275 test_expect_failure 'change file mode but keep old content' '
276 reinit_git &&
277 cat >expect <<-\EOF &&
vcs-svn/svndump.c
+5 -2
@@ -174,7 +174,8 @@ static void handle_node(void)
174
175 if (node_ctx.srcRev) {
176 repo_copy(node_ctx.srcRev, node_ctx.src, node_ctx.dst);
177 - node_ctx.action = NODEACT_CHANGE;
177 + if (node_ctx.action == NODEACT_ADD)
178 + node_ctx.action = NODEACT_CHANGE;
179 }
180
181 if (mark && type == REPO_MODE_DIR)
@@ -182,8 +183,10 @@ static void handle_node(void)
183
184 if (node_ctx.action == NODEACT_CHANGE)
185 node_ctx.type = repo_modify_path(node_ctx.dst, 0, mark);
185 - else /* Node-action: add */
186 + else if (node_ctx.action == NODEACT_ADD)
187 repo_add(node_ctx.dst, type, mark);
188 + else
189 + die("invalid dump: Node-path block lacks Node-action");
190
191 if (have_props) {
192 const uint32_t old_mode = node_ctx.type;