@matheusbsbs / matheus-bagliano / commits / 5af8fae2df
Fork 0

vcs-svn: handle_node: Handle deletion case early

Take care of "Node-action: delete" as soon as possible, so we can stop worrying about that case in the rest of the function. Functional change: catch deletion nodes with features that would not apply to them (text, properties, or origin data) and error out for those 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:49 UTC 5af8fae2df03d1888dbf315da29d1cdaa6214f57
1 file changed +8 -3
vcs-svn/svndump.c
+8 -3
@@ -159,6 +159,13 @@ static void handle_node(void)
159 if (node_ctx.textLength != LENGTH_UNKNOWN)
160 mark = next_blob_mark();
161
162 + if (node_ctx.action == NODEACT_DELETE) {
163 + if (mark || have_props || node_ctx.srcRev)
164 + die("invalid dump: deletion node has "
165 + "copyfrom info, text, or properties");
166 + return repo_delete(node_ctx.dst);
167 + }
168 +
169 if (have_props && node_ctx.propLength)
170 read_props();
171
@@ -168,9 +175,7 @@ static void handle_node(void)
175 if (mark && node_ctx.type == REPO_MODE_DIR)
176 die("invalid dump: directories cannot have text attached");
177
171 - if (node_ctx.action == NODEACT_DELETE) {
172 - repo_delete(node_ctx.dst);
173 - } else if (node_ctx.action == NODEACT_CHANGE ||
178 + if (node_ctx.action == NODEACT_CHANGE ||
179 node_ctx.action == NODEACT_REPLACE) {
180 if (node_ctx.action == NODEACT_REPLACE &&
181 node_ctx.type == REPO_MODE_DIR)