@matheusbsbs / matheus-bagliano / commits / 6ee4a9be48
Fork 0

vcs-svn: Replace = Delete + Add

Simplify by reducing the "Node-action: replace" case to "Node-action: add". This way, the main part of handle_node() only has to deal with "add" and "change" nodes. Functional change: replacing a symlink or executable without setting properties will reset the mode. 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 6ee4a9be48ee714ddacf313a7073dabdd6c6ee11
1 file changed +7 -6
vcs-svn/svndump.c
+7 -6
@@ -166,6 +166,11 @@ static void handle_node(void)
166 return repo_delete(node_ctx.dst);
167 }
168
169 + if (node_ctx.action == NODEACT_REPLACE) {
170 + repo_delete(node_ctx.dst);
171 + node_ctx.action = NODEACT_ADD;
172 + }
173 +
174 if (have_props && node_ctx.propLength)
175 read_props();
176
@@ -175,12 +180,8 @@ static void handle_node(void)
180 if (mark && node_ctx.type == REPO_MODE_DIR)
181 die("invalid dump: directories cannot have text attached");
182
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)
182 - repo_replace(node_ctx.dst, mark);
183 - else if (have_props)
183 + if (node_ctx.action == NODEACT_CHANGE) {
184 + if (have_props)
185 repo_modify(node_ctx.dst, node_ctx.type, mark);
186 else if (mark)
187 old_mode = repo_replace(node_ctx.dst, mark);