sussman@tigris.org writes:
> Log:
> Fix issue 1986: 'svn cp dir1 dir2' when dir1 contains a versioned symlink.
>
> * include/svn_io.h
> (svn_io_copy_link): new declaration.
>
> * libsvn_subr/io.c
> (svn_io_copy_link): new function.
> (svn_io_copy_dir_recursively): learn to copy symlinks; use APR
> functions directly, rather than svn_io_get_dirents (which is
> currently unable to report them.)
>
> * tests/clients/cmdline/special_tests.py
> (copy_tree_with_symlink): new regression test.
>
> [...]
>
> --- trunk/subversion/libsvn_subr/io.c (original)
> +++ trunk/subversion/libsvn_subr/io.c Thu Aug 5 17:30:18 2004
> @@ -364,6 +364,35 @@
> #endif
> }
>
> +
> +svn_error_t *
> +svn_io_copy_link (const char *src,
> + const char *dst,
> + apr_pool_t *pool)
> +
> +{
> +#ifdef HAVE_READLINK
> + svn_string_t *link_dest;
> + const char *dst_tmp;
> +
> + /* Notice what the link is pointing at... */
> + SVN_ERR (svn_io_read_link (&link_dest, src, pool));
> +
> + /* Make a tmp-link pointing at the same thing. */
> + SVN_ERR (svn_io_create_unique_link (&dst_tmp, dst, link_dest->data,
> + ".tmp", pool));
> +
> + /* Move the tmp-link to link. */
> + return svn_io_file_rename (dst_tmp, dst, pool);
> +
> +#else
> + return svn_error_create (SVN_ERR_UNSUPPORTED_FEATURE, NULL,
> + "Symbolic links are not supported on this "
> + "platform");
> +#endif
> +}
Is this tmpname/swap strategy necessary for symlinks? I think it
might be atomic to just create the new link right on top of the old
one...
-Karl
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sat Aug 7 00:48:31 2004