[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

[PATCH] Don't remove empty directories when creating repositories (in some cases)

From: Sergey Raevskiy <sergey.raevskiy_at_visualsvn.com>
Date: Mon, 30 Mar 2015 16:35:58 +0300

Hi!

I've noticed inconsistency in svn_repos_create() behavior. Despite the fact
that creation of repositories over empty directories is allowed, in some cases
this function will remove an empty directory that existed before repository
creation.

I've attached the patch with test and fix.

[[[
When creating a repository over an existing (empty) folder, don't remove this
empty folder if the creation fails.

* include/svn_io.h
 (svn_io_remove_dir_contents): Declare.

* libsvn_repos/repos.c
  (svn_repos_create): Don't remove the top-level repository directory if it
   existed before repository creation.

* subversion/libsvn_subr/io.c
  (remove_dir_helper,
   svn_io_remove_dir2): Extract core logic to new remove_dir_helper() function.
  (svn_io_remove_dir_contents): New.

* subversion/tests/libsvn_repos/repos-test.c
  (fail_to_create_repos_over_empty_dir): New test.
  (test_funcs): Add new test.

Patch by: sergey.raevskiy{_AT_}visualsvn.com
]]]

Received on 2015-03-30 15:36:49 CEST

This is an archived mail posted to the Subversion Dev mailing list.