Hi,
this is version 4 of my patch which aims to reject checkouts to
obstructed targets in order to protect the user from doing
unintended things. I've attached an interdiff to version 3.
There are no changes to the logic, version 4 only addresses
comments by Daniel:
- the listing callback now returns SVN_ERR_ITER_BREAK after
finding more than one entry, as we only need to know if there
is at least one file
- made pool usage more idiomatic
- renamed `error` variable to `err`
- renamed `absolute_path` to `target`
- changed code to handle unexpected errors of `svn_wc_status3`
- changed error messages to use `svn_dirent_local_style`
[[[
svn checkout: Refuse checkout to obstructed target directory.
When a new checkout is done where the target dirctory already
exists, subversion will usually create a lot of tree conflicts
which are intimidating, especially to new users. This behavior
stems from release 1.8, where we started accepting checkouts to
existing directories without any safety-checks.
This patch changes semantics in that it introduces new safety
checks so that the user does not accidentally shoots himself into
the foot. We now only allow checkouts if one of the following
conditions holds true:
- the target directory does not exist
- the target directory is empty
- the target directory is a repository and has the same UUID and
relative path as the repository that is to be checked out
- the repository to check out is empty
- the --force flag is given
The main use case solved by the above conditions is for
converting existing directories into a repository when the
repository is newly created as well as resuming checkouts.
* subversion/svn/checkout-cmd.c:
(listing_cb): New callback to check whether the remote
repository is empty.
(verify_checkout_target): New function to check whether the
target checkout directory is a valid
one.
(svn_cl__checkout): Now calls `verify_checkout_target` if no
--force flag is specified.
* subversion/tests/cmdline/checkout_tests.py:
(checkout_with_obstructions): Replace old test and now assert
that subversion refuses to
checkout to non-empty dirs.
]]]
Regards
Patrick
--
Patrick Steinhardt, Entwickler
elego Software Solutions GmbH, http://www.elego.de
Gebäude 12 (BIG), Gustav-Meyer-Allee 25, 13355 Berlin, Germany
Sitz der Gesellschaft: Berlin, USt-IdNr.: DE 163214194
Handelsregister: Amtsgericht Charlottenburg HRB 77719
Geschäftsführer: Olaf Wagner
Received on 2016-11-25 08:22:06 CET