diff options
author | Jonathan Nieder <jrnieder@gmail.com> | 2010-11-19 18:52:28 -0600 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2010-11-24 14:51:43 -0800 |
commit | 1c7bb316169c700df0d1711555564f86c9cb9366 (patch) | |
tree | dc453679591ae3d92c620af52ecaa0d2b7188490 | |
parent | 08c39b5c44449cb649ac32274e27be8046e373d4 (diff) | |
download | git-1c7bb316169c700df0d1711555564f86c9cb9366.tar.gz |
vcs-svn: Delay read of per-path properties
The mode for each file in an svn-format dump is kept in the properties
section. The properties section is read as soon as possible to allow
the correct mode to be filled in when registering the file with the
repo_tree lib.
To support nodes with a missing properties section, svn-fe determines
the mode in three stages:
- The kind (directory or file) of the node is read from the dump and
used to make an initial estimate (040000 or 100644).
- Properties are read in and allowed to override this for symlinks
and executables.
- If there is no properties section, the mode from the previous
content of the path is left alone, overriding the above
considerations.
This is a bit of a mess, and worse, it would get even more complicated
once we start to support property deltas. If we could only register
the file with a provisional value for mode and then change it later
when properties say so, the procedure would be much simpler.
... oh, right, we can.
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r-- | vcs-svn/svndump.c | 40 |
1 files changed, 18 insertions, 22 deletions
diff --git a/vcs-svn/svndump.c b/vcs-svn/svndump.c index e40be580a7..4fdfcbbc0d 100644 --- a/vcs-svn/svndump.c +++ b/vcs-svn/svndump.c @@ -150,7 +150,8 @@ static void read_props(void) static void handle_node(void) { - uint32_t old_mode = 0, mark = 0; + uint32_t mark = 0; + const uint32_t type = node_ctx.type; const int have_props = node_ctx.propLength != LENGTH_UNKNOWN; if (node_ctx.text_delta || node_ctx.prop_delta) @@ -171,33 +172,28 @@ static void handle_node(void) node_ctx.action = NODEACT_ADD; } - 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.srcRev) { + repo_copy(node_ctx.srcRev, node_ctx.src, node_ctx.dst); + node_ctx.action = NODEACT_CHANGE; + } - if (mark && node_ctx.type == REPO_MODE_DIR) + if (mark && type == REPO_MODE_DIR) die("invalid dump: directories cannot have text attached"); - if (node_ctx.action == NODEACT_CHANGE) { - if (have_props) + if (node_ctx.action == NODEACT_CHANGE) + node_ctx.type = repo_modify_path(node_ctx.dst, 0, mark); + else /* Node-action: add */ + repo_add(node_ctx.dst, type, mark); + + if (have_props) { + const uint32_t old_mode = node_ctx.type; + node_ctx.type = type; + if (node_ctx.propLength) + read_props(); + if (node_ctx.type != old_mode) repo_modify_path(node_ctx.dst, node_ctx.type, mark); - else if (mark) - old_mode = repo_modify_path(node_ctx.dst, 0, mark); - } else if (node_ctx.action == NODEACT_ADD) { - if (node_ctx.srcRev && have_props) - repo_modify_path(node_ctx.dst, node_ctx.type, mark); - else if (node_ctx.srcRev && mark) - old_mode = repo_modify_path(node_ctx.dst, 0, mark); - else if ((node_ctx.type == REPO_MODE_DIR && !node_ctx.srcRev) || - mark) - repo_add(node_ctx.dst, node_ctx.type, mark); } - if (!have_props && old_mode) - node_ctx.type = old_mode; - if (mark) fast_export_blob(node_ctx.type, mark, node_ctx.textLength); } |