git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jonathan Nieder <jrnieder@gmail.com>
To: git@vger.kernel.org
Cc: Ramkumar Ramachandra <artagnon@gmail.com>,
	Sverre Rabbelier <srabbelier@gmail.com>,
	David Barr <david.barr@cordelta.com>
Subject: [PATCH jn/svn-fe] vcs-svn: Allow change nodes for root of tree (/)
Date: Mon, 6 Dec 2010 16:19:32 -0600	[thread overview]
Message-ID: <20101206221931.GA13401@burratino> (raw)
In-Reply-To: <20101120005334.GL17445@burratino>

It is not uncommon for a svn repository to include change records for
properties at the top level of the tracked tree:

	Node-path: 
	Node-kind: dir
	Node-action: change
	Prop-delta: true
	Prop-content-length: 43
	Content-length: 43

	K 10
	svn:ignore
	V 11
	build-area

	PROPS-END

Unfortunately a recent svn-fe change (vcs-svn: More dump format sanity
checks, 2010-11-19) causes such nodes to be rejected with the error
message

	fatal: invalid dump: path to be modified is missing

The repo_tree module does not keep a dirent for the root of the tree.
Add a block to the dump parser to take care of this case.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
---
 t/t9010-svn-fe.sh |   73 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 vcs-svn/svndump.c |    5 +++-
 2 files changed, 77 insertions(+), 1 deletions(-)

diff --git a/t/t9010-svn-fe.sh b/t/t9010-svn-fe.sh
index 7dc0670..04ce97d 100755
--- a/t/t9010-svn-fe.sh
+++ b/t/t9010-svn-fe.sh
@@ -580,6 +580,79 @@ test_expect_success 'property deltas supported' '
 	test_cmp expect actual
 '
 
+test_expect_success 'properties on /' '
+	reinit_git &&
+	cat <<-\EOF >expect &&
+	OBJID
+	OBJID
+	:000000 100644 OBJID OBJID A	greeting
+	EOF
+	sed -e "s/X$//" <<-\EOF >changeroot.dump &&
+	SVN-fs-dump-format-version: 3
+
+	Revision-number: 1
+	Prop-content-length: 10
+	Content-length: 10
+
+	PROPS-END
+
+	Node-path: greeting
+	Node-kind: file
+	Node-action: add
+	Text-content-length: 0
+	Prop-content-length: 10
+	Content-length: 10
+
+	PROPS-END
+
+	Revision-number: 2
+	Prop-content-length: 10
+	Content-length: 10
+
+	PROPS-END
+
+	Node-path: X
+	Node-kind: dir
+	Node-action: change
+	Prop-delta: true
+	Prop-content-length: 43
+	Content-length: 43
+
+	K 10
+	svn:ignore
+	V 11
+	build-area
+
+	PROPS-END
+	EOF
+	echo Revision-number: 2 &&
+	echo Prop-content-length: $(wc -c <revprops) &&
+	echo Content-length: $(wc -c <revprops) &&
+	echo &&
+	cat revprops &&
+	echo &&
+	cat <<-\EOF
+	Node-path: script.sh
+	Node-kind: file
+	Node-action: change
+	Prop-delta: true
+	Prop-content-length: 30
+	Content-length: 30
+
+	D 14
+	svn:executable
+	PROPS-END
+	EOF
+	test-svn-fe changeroot.dump >stream &&
+	git fast-import <stream &&
+	{
+		git rev-list HEAD |
+		git diff-tree --root --always --stdin |
+		sed "s/$_x40/OBJID/g"
+	} >actual &&
+	test_cmp expect actual
+'
+
 test_expect_success 'deltas for typechange' '
 	reinit_git &&
 	cat >expect <<-\EOF &&
diff --git a/vcs-svn/svndump.c b/vcs-svn/svndump.c
index d2a5347..6543b51 100644
--- a/vcs-svn/svndump.c
+++ b/vcs-svn/svndump.c
@@ -203,7 +203,10 @@ static void handle_node(void)
 	}
 	if (mark && type == REPO_MODE_DIR)
 		die("invalid dump: directories cannot have text attached");
-	if (node_ctx.action == NODEACT_CHANGE) {
+	if (node_ctx.action == NODEACT_CHANGE && !~*node_ctx.dst) {
+		if (type != REPO_MODE_DIR)
+			die("invalid dump: root of tree is not a regular file");
+	} else if (node_ctx.action == NODEACT_CHANGE) {
 		uint32_t mode = repo_modify_path(node_ctx.dst, 0, mark);
 		if (!mode)
 			die("invalid dump: path to be modified is missing");
-- 
1.7.2.4

  parent reply	other threads:[~2010-12-06 22:19 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-18  5:00 [PATCH 0/2] svn-fe: recognize v3 dumps Jonathan Nieder
2010-11-18  5:02 ` [PATCH 1/2] vcs-svn: Error out for " Jonathan Nieder
2010-11-18  5:03 ` [PATCH 2/2] vcs-svn: Allow simple v3 dumps (no deltas yet) Jonathan Nieder
2010-11-20  0:45 ` [RFC/PATCH 0/15] svn-fe: support for property deltas (but not text " Jonathan Nieder
2010-11-20  0:46   ` [PATCH 01/15] vcs-svn: Check for errors from open() Jonathan Nieder
2010-11-20  0:46   ` [PATCH 02/15] vcs-svn: Eliminate node_ctx.srcRev global Jonathan Nieder
2010-11-20  0:46   ` [PATCH 03/15] vcs-svn: Eliminate node_ctx.mark global Jonathan Nieder
2010-11-20  0:47   ` [PATCH 04/15] vcs-svn: Unclutter handle_node by introducing have_props var Jonathan Nieder
2010-11-20  0:48   ` [PATCH 05/15] vcs-svn: Use mark to indicate nodes with included text Jonathan Nieder
2010-11-20  0:49   ` [PATCH 06/15] vcs-svn: handle_node: Handle deletion case early Jonathan Nieder
2010-11-20  0:49   ` [PATCH 07/15] vcs-svn: Replace = Delete + Add Jonathan Nieder
2010-11-20  0:51   ` [PATCH 08/15] vcs-svn: Combine repo_replace and repo_modify functions Jonathan Nieder
2010-11-20  0:52   ` [PATCH 09/15] vcs-svn: Delay read of per-path properties Jonathan Nieder
2010-11-20  0:52   ` [PATCH 10/15] vcs-svn: Reject path nodes without Node-action Jonathan Nieder
2010-11-20 14:53     ` Jonathan Nieder
2010-11-20  0:53   ` [PATCH 11/15] vcs-svn: More dump format sanity checks Jonathan Nieder
2010-11-30 19:48     ` Jonathan Nieder
     [not found]       ` <20101205091605.GA4332@burratino>
2010-12-05  9:32         ` [PATCH 2/2] vcs-svn: fix intermittent repo_tree corruption Jonathan Nieder
2010-12-05  9:33       ` [PATCH jn/svn-fe-maint 0/2] " Jonathan Nieder
2010-12-05  9:35         ` [PATCH 1/2] treap: make treap_insert return inserted node Jonathan Nieder
2010-12-06 22:19     ` Jonathan Nieder [this message]
2010-12-06 23:12       ` [PATCH jn/svn-fe] vcs-svn: Allow change nodes for root of tree (/) Jonathan Nieder
2010-11-20  0:53   ` [PATCH 12/15] vcs-svn: Make source easier to read on small screens Jonathan Nieder
2010-11-20  0:54   ` [PATCH 13/15] vcs-svn: Split off function for handling of individual properties Jonathan Nieder
2010-11-20  0:54   ` [PATCH 14/15] vcs-svn: Sharpen parsing of property lines Jonathan Nieder
2010-11-20  0:57   ` [PATCH 15/15] vcs-svn: Implement Prop-delta handling Jonathan Nieder
2010-11-20 19:21   ` [WIP/PATCH 0/8] svn-fe: support for text deltas Jonathan Nieder
2010-11-20 19:22     ` [PATCH 1/8] svn-fe: Prepare for strbuf use Jonathan Nieder
2010-11-20 19:25     ` [PATCH 2/8] vcs-svn: Internal fast_export_save_blob helper Jonathan Nieder
2010-11-20 19:25     ` [PATCH 3/8] vcs-svn: Introduce repo_read_path to check the content at a path Jonathan Nieder
2011-03-06 12:29       ` Jonathan Nieder
2010-11-20 19:26     ` [PATCH 4/8] vcs-svn: Introduce fd_buffer routines Jonathan Nieder
2010-11-20 19:27     ` [PATCH 5/8] vcs-svn: Read delta preimage from file descriptor Jonathan Nieder
2010-11-20 19:28     ` [PATCH 6/8] vcs-svn: Let caller set up sliding window for delta preimage Jonathan Nieder
2010-11-20 19:31       ` Jonathan Nieder
2010-11-20 19:29     ` [PATCH 7/8] vcs-svn: Teach line_buffer about temporary files Jonathan Nieder
2010-11-20 19:29     ` [PATCH 8/8] vcs-svn: Implement text-delta handling Jonathan Nieder
2010-12-04 17:34       ` [PATCH 10/8] vcs-svn: Consume whole preimage when applying deltas Jonathan Nieder
2010-11-20 19:30     ` [PATCH 9/8] svn-fe: Test script for handling of dumps with --deltas Jonathan Nieder
2010-12-04 17:29       ` Jonathan Nieder

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20101206221931.GA13401@burratino \
    --to=jrnieder@gmail.com \
    --cc=artagnon@gmail.com \
    --cc=david.barr@cordelta.com \
    --cc=git@vger.kernel.org \
    --cc=srabbelier@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).