[PATCH 05/15] vcs-svn: Use mark to indicate nodes with included text

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

 



Allocate a mark if needed as soon as possible so later code can use
"if (mark)" to check if this node has text attached rather than
explicitly checking for Text-content-length.

While at it, reject directory nodes with text attached; the presence
of such a node would indicate a bug in the dump generator or svn-fe's
understanding.  In the long term, it would be nice to be able to
continue parsing and save the error for later, but for now it is
simpler to error out right away.

Signed-off-by: Jonathan Nieder <jrnieder@xxxxxxxxx>
---
 vcs-svn/svndump.c |   16 ++++++++--------
 1 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/vcs-svn/svndump.c b/vcs-svn/svndump.c
index 45f0e47..844076b 100644
--- a/vcs-svn/svndump.c
+++ b/vcs-svn/svndump.c
@@ -156,15 +156,17 @@ static void handle_node(void)
 	if (node_ctx.text_delta || node_ctx.prop_delta)
 		die("text and property deltas not supported");
 
+	if (node_ctx.textLength != LENGTH_UNKNOWN)
+		mark = next_blob_mark();
+
 	if (have_props && node_ctx.propLength)
 		read_props();
 
 	if (node_ctx.srcRev)
 		old_mode = repo_copy(node_ctx.srcRev, node_ctx.src, node_ctx.dst);
 
-	if (node_ctx.textLength != LENGTH_UNKNOWN &&
-	    node_ctx.type != REPO_MODE_DIR)
-		mark = next_blob_mark();
+	if (mark && node_ctx.type == REPO_MODE_DIR)
+		die("invalid dump: directories cannot have text attached");
 
 	if (node_ctx.action == NODEACT_DELETE) {
 		repo_delete(node_ctx.dst);
@@ -175,15 +177,15 @@ static void handle_node(void)
 			repo_replace(node_ctx.dst, mark);
 		else if (have_props)
 			repo_modify(node_ctx.dst, node_ctx.type, mark);
-		else if (node_ctx.textLength != LENGTH_UNKNOWN)
+		else if (mark)
 			old_mode = repo_replace(node_ctx.dst, mark);
 	} else if (node_ctx.action == NODEACT_ADD) {
 		if (node_ctx.srcRev && have_props)
 			repo_modify(node_ctx.dst, node_ctx.type, mark);
-		else if (node_ctx.srcRev && node_ctx.textLength != LENGTH_UNKNOWN)
+		else if (node_ctx.srcRev && mark)
 			old_mode = repo_replace(node_ctx.dst, mark);
 		else if ((node_ctx.type == REPO_MODE_DIR && !node_ctx.srcRev) ||
-			 node_ctx.textLength != LENGTH_UNKNOWN)
+			 mark)
 			repo_add(node_ctx.dst, node_ctx.type, mark);
 	}
 
@@ -192,8 +194,6 @@ static void handle_node(void)
 
 	if (mark)
 		fast_export_blob(node_ctx.type, mark, node_ctx.textLength);
-	else if (node_ctx.textLength != LENGTH_UNKNOWN)
-		buffer_skip_bytes(node_ctx.textLength);
 }
 
 static void handle_revision(void)
-- 
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]