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) @@ -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__':