Thread (1 message) 1 message, 1 author, 2016-06-15
DORMANTno replies

[PATCH db/vcs-svn-incremental] vcs-svn: avoid git-isms in fast-import stream

From: Jonathan Nieder <hidden>
Date: 2016-06-15 22:50:14
Subsystem: the rest · Maintainer: Linus Torvalds

Jonathan Nieder wrote:
I am not totally happy with the result, since it adds another
git-specific detail to svn-fe (the first was hardcoding the
empty blob sha1 instead of using

	blob
	mark :0
	data 0

).
Maybe this would help?

-- 8< --
Subject: vcs-svn: avoid git-isms in fast-import stream

Current svn-fe is not likely to work without change with other
fast-import backends, but don't let that stop us from trying:

 - instead of suppressing copies of empty trees, let the backend
   decide what to do with them;

 - use a mark instead of hard-coding git's name for the empty blob.

However, we do not include commands in the stream for new empty
directories, since no syntax is documented for that yet.

Signed-off-by: Jonathan Nieder <redacted>
---
 vcs-svn/fast_export.c |    8 +-------
 vcs-svn/svndump.c     |    2 +-
 2 files changed, 2 insertions(+), 8 deletions(-)
diff --git a/vcs-svn/fast_export.c b/vcs-svn/fast_export.c
index 75d674e..85166a6 100644
--- a/vcs-svn/fast_export.c
+++ b/vcs-svn/fast_export.c
@@ -40,12 +40,6 @@ void fast_export_delete(uint32_t depth, const uint32_t *path)
 void fast_export_modify(uint32_t depth, const uint32_t *path, uint32_t mode,
 			const char *dataref)
 {
-	/* Git does not track empty directories. */
-	if (S_ISDIR(mode) && !strcmp(dataref, EMPTY_TREE_SHA1_HEX)) {
-		fast_export_delete(depth, path);
-		return;
-	}
-
 	/* Mode must be 100644, 100755, 120000, or 160000. */
 	printf("M %06"PRIo32" %s ", mode, dataref);
 	pool_print_seq(depth, path, '/', stdout);
@@ -255,7 +249,7 @@ void fast_export_data(uint32_t mode, uint32_t len, struct line_buffer *input)
 
 void fast_export_empty_blob(void)
 {
-	printf("blob\ndata 0\n\n");
+	printf("blob\nmark :0\ndata 0\n\n");
 }
 
 void fast_export_delta(const uint32_t *path, uint32_t mode, uint32_t old_mode,
diff --git a/vcs-svn/svndump.c b/vcs-svn/svndump.c
index 68a8435..e28e762 100644
--- a/vcs-svn/svndump.c
+++ b/vcs-svn/svndump.c
@@ -244,7 +244,7 @@ static void handle_node(void)
 		if (type == REPO_MODE_DIR)
 			old_data = NULL;
 		else if (have_text)
-			old_data = EMPTY_BLOB_SHA1_HEX;
+			old_data = ":0";
 		else
 			die("invalid dump: adds node without text");
 	} else {
-- 
1.7.2.4
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help