Index: subversion/libsvn_client/commit.c =================================================================== --- subversion/libsvn_client/commit.c (revision 20249) +++ subversion/libsvn_client/commit.c (working copy) @@ -1289,26 +1289,35 @@ APR_ARRAY_PUSH(dirs_to_lock_recursive, const char *) = apr_pstrdup(pool, target); else - APR_ARRAY_PUSH(dirs_to_lock, - const char *) = apr_pstrdup(pool, target); + /* Don't lock if target is the base_dir, base_dir will be + locked anyway and we can't lock it twice */ + if (strcmp(target, base_dir)) + APR_ARRAY_PUSH(dirs_to_lock, + const char *) = apr_pstrdup(pool, target); } /* Now we need to iterate over the parent paths of this path - adding them to the set of directories we want to lock. */ - svn_path_split(target, &parent_dir, &name, subpool); + adding them to the set of directories we want to lock. + Do nothing if target is already the base_dir. */ + if (strcmp(target, base_dir)) + { + svn_path_split(target, &parent_dir, &name, subpool); - target = parent_dir; + target = parent_dir; - while (strcmp(target, base_dir)) - { - if (target[0] == '/' && target[1] == '\0') - abort(); + while (strcmp(target, base_dir)) + { + if ((target[0] == '/' && target[1] == '\0') || + (target[0] == '\0')) + abort(); - APR_ARRAY_PUSH(dirs_to_lock, - const char *) = apr_pstrdup(pool, target); - target = svn_path_dirname(target, subpool); + APR_ARRAY_PUSH(dirs_to_lock, + const char *) = apr_pstrdup(pool, target); + target = svn_path_dirname(target, subpool); + } } } + svn_pool_destroy(subpool); } Index: subversion/tests/cmdline/commit_tests.py =================================================================== --- subversion/tests/cmdline/commit_tests.py (revision 20249) +++ subversion/tests/cmdline/commit_tests.py (working copy) @@ -1989,7 +1989,40 @@ svntest.actions.run_and_verify_svn (None, expected_output, [], 'ci', '-m', 'log msg', iota_path) +#---------------------------------------------------------------------- +# Commit two targets non-recursively, but both targets should be the +# same folder (in multiple variations). Test that svn handles this correctly. +def commit_same_folder_in_targets(sbox): + "commit two targets, both the same folder" + sbox.build() + wc_dir = sbox.wc_dir + + iota_path = os.path.join(wc_dir, 'iota') + + svntest.main.file_append (iota_path, "added extra line to file iota") + + # Create expected output tree. + expected_output = svntest.wc.State(wc_dir, { + 'iota' : Item(verb='Sending'), + }) + + # Created expected status tree. + expected_status = svntest.actions.get_virginal_state(wc_dir, 2) + expected_status.tweak(wc_rev=1) + expected_status.tweak('iota', wc_rev=2) + + # Commit the wc_dir and iota. + svntest.actions.run_and_verify_commit (wc_dir, + expected_output, + expected_status, + None, + None, None, + None, None, + '-N', + wc_dir, + iota_path) + ######################################################################## # Run the tests @@ -2029,7 +2062,8 @@ mods_in_schedule_delete, Skip(tab_test, (os.name != 'posix' or sys.platform == 'cygwin')), local_mods_are_not_commits, - post_commit_hook_test + post_commit_hook_test, + commit_same_folder_in_targets, ] if __name__ == '__main__':