Checkout
philip
committed
on 01 Sep 02
Rework the path library to accept and return "" as the only canonical
empty path. Make sure the client canonicalizes all paths passed to
th… Show more
Rework the path library to accept and return "" as the only canonical

empty path.  Make sure the client canonicalizes all paths passed to

the libraries. The path library now assumes that its inputs are

canonical.  Remove the use of explicit "." except for a few special

cases.

* subversion/include/svn_path.h (svn_path_join, svn_path_split,

 svn_path_is_empty, svn_path_is_single_path_component,

 svn_path_split_if_file, svn_path_url_add_component): Tweak documentation.

* subversion/libsvn_subr/path.c

 (SVN_EMPTY_PATH, SVN_PATH_IS_EMPTY, SVN_PATH_IS_PLATFORM_EMPTY): New macros.

 (SVN_PATH_SEPARATOR): Delete macro as we cannot change the separator. Change

 all uses in the file to an explicit '/'.

 (discount_trailing_dot_slash, is_canonical_nts): New functions.

 (svn_path_canonicalize, svn_path_canonicalize_nts): Strip trailing

 dots as well as slashes, convert "." to "".

 (svn_path_join_many): Rework without considering ".".

 (add_component_internal): No need to canonicalize.

 (svn_path_remove_component, svn_path_remove_component_nts): No need

 to canonicalize input. After removing component, strip trailing dots

 and slashes, and convert "." to "".

 (svn_path_basename): Convert "." to "".

 (svn_path_split): No need to canonicalize input.

 (svn_path_get_longest_ancestor): No need to canonicalize inputs.

 (svn_path_decompose): Convert "." to "".

 (svn_path_split_if_file): Return "" as empty path if input is a

 directory.

 (svn_path_url_add_component): Canonicalize input URL.

 (svn_path_internal_style, svn_path_local_style, svn_path_join,

 svn_path_is_empty, svn_path_is_empty_nts, svn_path_compare_paths,

 svn_path_compare_paths_nts, svn_path_is_child,

 svn_path_is_single_path_component): Change to use new macros, or to

 use explicit '/', or to assert canonical input.

* subversion/clients/cmdline/util.c

 (svn_cl__args_to_target_array): Add canonicalization of paths.  Move

 svn_path_basename call after UTF-8 and canonicalization.

 (svn_cl__edit_externally): Convert "" to "." to satisfy APR.

* subversion/tests/libsvn_subr/path-test.c

 (SVN_EMPTY_PATH): New macro.

 (test_path_split): Remove non-canonical inputs. Add new tests.  Test

 svn_path_split_nts as well.

 (test_join, test_basename): Remove non-canonical inputs. Add new tests.

 (test_canonicalize): New test.

* subversion/libsvn_subr/io.c (svn_io_remove_dir, svn_io_stat, svn_io_dir_open,

 apr_dir_is_empty): Convert "" to "." to satisfy APR.

* subversion/libsvn_client/update.c (svn_client_update): Accept "" path.

* subversion/mod_dav_svn/update.c (get_from_path_map): Break on "/". How did

 this ever work before?

* subversion/clients/cmdline/revert-cmd.c (svn_cl__revert): Delete

 svn_path_canonicalize_nts call.

* subversion/clients/cmdline/update-cmd.c (svn_cl__update): Delete

 svn_path_canonicalize_nts call.

Replace explicit "." with "" and remove the construct

  if (svn_path_is_empty_nts(path))

    path = "."

from the following files

* subversion/libsvn_wc/entries.c

* subversion/libsvn_wc/adm_ops.c

* subversion/libsvn_wc/adm_files.c

* subversion/libsvn_wc/update_editor.c

* subversion/libsvn_client/switch.c

* subversion/libsvn_client/ra.c

* subversion/libsvn_client/delete.c

* subversion/libsvn_client/diff.c

* subversion/libsvn_client/copy.c

* subversion/libsvn_client/repos_diff.c

* subversion/libsvn_client/commit_util.c

* subversion/libsvn_client/commit.c

* subversion/libsvn_client/add.c

* subversion/libsvn_client/commit.c

* subversion/clients/cmdline/merge-cmd.c

* subversion/clients/cmdline/checkout-cmd.c

* subversion/clients/cmdline/switch-cmd.c

* subversion/clients/cmdline/import-cmd.c

* subversion/libsvn_ra_dav/fetch.c

* subversion/libsvn_ra_dav/commit.c

Show less