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

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Jonathan Nieder
Date: Saturday, December 11, 2010 - 4:00 pm

Jonathan Nieder wrote:


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 <jrnieder@gmail.com>
---
 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

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH 01/10] vcs-svn: use higher mark numbers for blobs, Jonathan Nieder, (Fri Dec 10, 3:21 am)
[PATCH 02/10] vcs-svn: save marks for imported commits, Jonathan Nieder, (Fri Dec 10, 3:22 am)
[PATCH 06/10] vcs-svn: do not rely on marks for old blobs, Jonathan Nieder, (Fri Dec 10, 3:26 am)
[PATCH 10/10] vcs-svn: eliminate repo_tree structure, Jonathan Nieder, (Fri Dec 10, 3:33 am)
[PATCH db/vcs-svn-incremental] vcs-svn: avoid git-isms in ..., Jonathan Nieder, (Sat Dec 11, 4:00 pm)
[PATCH 12/10] vcs-svn: quote paths correctly for ls command, David Michael Barr, (Sat Dec 11, 4:04 pm)
[PATCH 13/10] vcs-svn: use mark from previous import for p ..., David Michael Barr, (Sun Dec 12, 2:32 am)