Index: subversion/libsvn_subr/io.c =================================================================== --- subversion/libsvn_subr/io.c (revision 14140) +++ subversion/libsvn_subr/io.c (working copy) @@ -711,7 +711,9 @@ subpool)); } else if (this_entry.filetype == APR_DIR) /* recurse */ - { + { + if (strcmp (this_entry.name, dst_basename)==0) + continue; SVN_ERR (svn_io_copy_dir_recursively (src_target, dst_path, Index: subversion/tests/clients/cmdline/copy_tests.py =================================================================== --- subversion/tests/clients/cmdline/copy_tests.py (revision 14140) +++ subversion/tests/clients/cmdline/copy_tests.py (working copy) @@ -1544,6 +1544,31 @@ +#---------------------------------------------------------------------- +# Test fix for issue 2224 - copying wc dir to itself causes endless +# recursion +def wc_copy_dir_to_itself(sbox): + "copy wc dir to itself" + + sbox.build() + wc_dir = sbox.wc_dir + dnames = ['A','A/B'] + + for dirname in dnames: + dir_path = os.path.join(sbox.wc_dir, dirname) + + # try to copy dir to itself + ## TODO need to kill the process after a couple of seconds + ## to prevent infinite wait + output, err = svntest.main.run_svn(1, 'copy', dir_path, dir_path) + error_msg = "svn: Cannot copy path '" + dir_path + "' into itself" + for line in err: + if line.find(error_msg) != -1: + break + else: + print "Failed to find '", error_msg, "' in: ", err + raise svntest.Failure + ######################################################################## # Run the tests @@ -1577,6 +1602,7 @@ url_to_non_existent_url_path, non_existent_url_to_url, old_dir_url_to_url, + wc_copy_dir_to_itself, ] if __name__ == '__main__':