summaryrefslogtreecommitdiff
path: root/vcs-svn/svndump.c
diff options
context:
space:
mode:
authorJonathan Nieder <jrnieder@gmail.com>2010-11-20 00:47:41 (GMT)
committerJunio C Hamano <gitster@pobox.com>2010-11-24 22:51:42 (GMT)
commitd6e81a03153810f122f1b8ec3635fd84c5429f69 (patch)
treef034fbc353a61a75a4d43ca90c8def383d604e79 /vcs-svn/svndump.c
parentda3e217447390d52363989474a5e33bd298ff3ad (diff)
downloadgit-d6e81a03153810f122f1b8ec3635fd84c5429f69.zip
git-d6e81a03153810f122f1b8ec3635fd84c5429f69.tar.gz
git-d6e81a03153810f122f1b8ec3635fd84c5429f69.tar.bz2
vcs-svn: Unclutter handle_node by introducing have_props var
It is possible for a path node in an SVN-format dump file to leave out the properties section. svn-fe handles this by carrying over the properties (in particular, file type) from the old version of that node. To support this, handle_node tests several times whether a Prop-content-length field is present. Ancient Subversion actually leaves out the Prop-content-length field even for nodes with properties, so that's not quite the right check. Besides, this detail of mechanism is distracting when the question at hand is instead what content the new node should have. So introduce a local have_props variable. The semantics are the same as before; the adaptations to support ancient streams that leave out the prop-content-length can wait until someone needs them. Signed-off-by: Jonathan Nieder <jrnieer@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'vcs-svn/svndump.c')
-rw-r--r--vcs-svn/svndump.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/vcs-svn/svndump.c b/vcs-svn/svndump.c
index 1fb7f82..45f0e47 100644
--- a/vcs-svn/svndump.c
+++ b/vcs-svn/svndump.c
@@ -151,11 +151,12 @@ static void read_props(void)
static void handle_node(void)
{
uint32_t old_mode = 0, mark = 0;
+ const int have_props = node_ctx.propLength != LENGTH_UNKNOWN;
if (node_ctx.text_delta || node_ctx.prop_delta)
die("text and property deltas not supported");
- if (node_ctx.propLength != LENGTH_UNKNOWN && node_ctx.propLength)
+ if (have_props && node_ctx.propLength)
read_props();
if (node_ctx.srcRev)
@@ -172,12 +173,12 @@ static void handle_node(void)
if (node_ctx.action == NODEACT_REPLACE &&
node_ctx.type == REPO_MODE_DIR)
repo_replace(node_ctx.dst, mark);
- else if (node_ctx.propLength != LENGTH_UNKNOWN)
+ else if (have_props)
repo_modify(node_ctx.dst, node_ctx.type, mark);
else if (node_ctx.textLength != LENGTH_UNKNOWN)
old_mode = repo_replace(node_ctx.dst, mark);
} else if (node_ctx.action == NODEACT_ADD) {
- if (node_ctx.srcRev && node_ctx.propLength != LENGTH_UNKNOWN)
+ 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)
old_mode = repo_replace(node_ctx.dst, mark);
@@ -186,7 +187,7 @@ static void handle_node(void)
repo_add(node_ctx.dst, node_ctx.type, mark);
}
- if (node_ctx.propLength == LENGTH_UNKNOWN && old_mode)
+ if (!have_props && old_mode)
node_ctx.type = old_mode;
if (mark)