Index: subversion/libsvn_client/copy.c =================================================================== --- subversion/libsvn_client/copy.c (revision 14140) +++ subversion/libsvn_client/copy.c (working copy) @@ -1048,6 +1048,15 @@ } else { + if (src_is_url == dst_is_url) + { + if (strcmp (src_path, dst_path) == 0) + return svn_error_createf + (SVN_ERR_UNSUPPORTED_FEATURE, NULL, + _("Cannot copy path '%s' into itself"), + svn_path_local_style (src_path, pool)); + } + if (!src_is_url) { if (src_revision->kind != svn_opt_revision_unspecified 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) @@ -17,7 +17,7 @@ ###################################################################### # General modules -import stat, string, sys, os, shutil, re +import stat, string, sys, os, shutil, re, time # Our testing module import svntest @@ -1544,6 +1544,35 @@ +#---------------------------------------------------------------------- +# Test fix for issue 2224 - copying dir to same dir in wc causes endless +# recursion +def wc_copy_dir_to_same_dir(sbox): + "copy wc dir to same wc dir" + + 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 + # need to set up a timer to kill the process (try block?) + # after a couple of seconds - TBD + 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 "copy wc path to itself should have been failed" + raise svntest.Failure + break + +#svn: Cannot copy path '/tmp/wc_fs/A1' into itself + + ######################################################################## # Run the tests @@ -1577,6 +1606,7 @@ url_to_non_existent_url_path, non_existent_url_to_url, old_dir_url_to_url, + wc_copy_dir_to_same_dir, ] if __name__ == '__main__':