[PATCH 07/15] vcs-svn: Replace = Delete + Add

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx>
---
I was happy to discover this.

 vcs-svn/svndump.c |   13 +++++++------
 1 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/vcs-svn/svndump.c b/vcs-svn/svndump.c
index bc70023..6a6aaf9 100644
--- a/vcs-svn/svndump.c
+++ b/vcs-svn/svndump.c
@@ -166,6 +166,11 @@ static void handle_node(void)
 		return repo_delete(node_ctx.dst);
 	}
 
+	if (node_ctx.action == NODEACT_REPLACE) {
+		repo_delete(node_ctx.dst);
+		node_ctx.action = NODEACT_ADD;
+	}
+
 	if (have_props && node_ctx.propLength)
 		read_props();
 
@@ -175,12 +180,8 @@ static void handle_node(void)
 	if (mark && node_ctx.type == REPO_MODE_DIR)
 		die("invalid dump: directories cannot have text attached");
 
-	if (node_ctx.action == NODEACT_CHANGE ||
-			   node_ctx.action == NODEACT_REPLACE) {
-		if (node_ctx.action == NODEACT_REPLACE &&
-		    node_ctx.type == REPO_MODE_DIR)
-			repo_replace(node_ctx.dst, mark);
-		else if (have_props)
+	if (node_ctx.action == NODEACT_CHANGE) {
+		if (have_props)
 			repo_modify(node_ctx.dst, node_ctx.type, mark);
 		else if (mark)
 			old_mode = repo_replace(node_ctx.dst, mark);
-- 
1.7.2.3

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]