On the '1.6.x-issue3303' branch:
Merge from trunk (with conflict resolution and changes due to latest
development in trunk) r950931, 950933.
git-svn-id: https://svn.apache.org/repos/asf/subversion/branches/1.6.x-issue3303@950952 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/subversion/libsvn_wc/copy.c b/subversion/libsvn_wc/copy.c
index d082f15..f534dde 100644
--- a/subversion/libsvn_wc/copy.c
+++ b/subversion/libsvn_wc/copy.c
@@ -101,12 +101,20 @@
void *notify_baton,
apr_pool_t *pool)
{
+ svn_node_kind_t kind;
+ svn_boolean_t is_special;
const char *dst_path
= svn_path_join(svn_wc_adm_access_path(dst_parent_access),
dst_basename, pool);
- /* Copy this file and possibly put it under version control. */
- SVN_ERR(svn_io_copy_file(src_path, dst_path, TRUE, pool));
+ /* Check to see if this is a special file. */
+ SVN_ERR(svn_io_check_special_path(src_path, &kind, &is_special,
+ pool));
+
+ if (is_special)
+ SVN_ERR(svn_io_copy_link(src_path, dst_path, pool));
+ else
+ SVN_ERR(svn_io_copy_file(src_path, dst_path, TRUE, pool));
if (src_is_added)
{
diff --git a/subversion/tests/cmdline/copy_tests.py b/subversion/tests/cmdline/copy_tests.py
index 952d8d6..3442db1 100755
--- a/subversion/tests/cmdline/copy_tests.py
+++ b/subversion/tests/cmdline/copy_tests.py
@@ -4092,6 +4092,37 @@
expected_status)
+def copy_broken_symlink(sbox):
+ """copy broken symlink"""
+
+ ## See http://subversion.tigris.org/issues/show_bug.cgi?id=3303. ##
+
+ sbox.build()
+ wc_dir = sbox.wc_dir
+
+ new_symlink = os.path.join(wc_dir, 'new_symlink');
+ copied_symlink = os.path.join(wc_dir, 'copied_symlink');
+ os.symlink('linktarget', new_symlink)
+
+ # Alias for svntest.actions.run_and_verify_svn
+ rav_svn = svntest.actions.run_and_verify_svn
+
+ rav_svn(None, None, [], 'add', new_symlink)
+ rav_svn(None, None, [], 'cp', new_symlink, copied_symlink)
+
+ # Check whether both new_symlink and copied_symlink are added to the
+ # working copy
+ expected_status = svntest.actions.get_virginal_state(wc_dir, 1)
+
+ expected_status.add(
+ {
+ 'new_symlink' : Item(status='A ', wc_rev='0'),
+ 'copied_symlink' : Item(status='A ', wc_rev='0'),
+ })
+
+ svntest.actions.run_and_verify_status(wc_dir, expected_status)
+
+
########################################################################
# Run the tests
@@ -4174,6 +4205,7 @@
find_copyfrom_information_upstairs,
path_move_and_copy_between_wcs_2475,
path_copy_in_repo_2475,
+ SkipUnless(copy_broken_symlink, svntest.main.is_posix_os),
]
if __name__ == '__main__':