subversion-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Patrick Steinhardt <>
Subject [PATCH v2] Reject checkouts to existing directory
Date Tue, 18 Oct 2016 12:22:25 GMT

finally got around to update my patch regarding checkouts to
existing directories. The semantics have been changed to accept
checkouts iff

- the target directory does not exist
- the target directory is empty
- the repository to check out is empty
- the --force flag is given

This should treat all cases pointed out by Ivan. There were quite
a lot of test cases that needed adjustment following this change.
I've mostly added the '--force' flag, but also replaced a test
which didn't make sense anymore with a new one (that is 'co to a
dir without --force with obstructions'). The new test case simply
check is we reject checking out a non-empty repo to a non-empty

All but two unrelated tests pass with this.

Reject checkouts which would create tree conflicts.

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 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.

* 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 is specified.
* subversion/tests/cmdline/
   inheritable_autoprops_test): use 'co --force'.
* subversion/tests/cmdline/
   basic_auth_test): use 'co --force'.
* subversion/tests/cmdline/
  (checkout_with_obstructions): Replace old test and now assert
   that subversion refuses to checkout to non-empty dirs.
* subversion/tests/cmdline/svntest/
  (run_and_verify_checkout): use 'co --force'.
* subversion/tests/cmdline/
  (ensure_tree_conflict): use 'co --force'.

Patrick Steinhardt, Entwickler

elego Software Solutions GmbH,
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

View raw message