Hi,

attached is a patch to reject checkouts to already existing
directories when `--force` is not given. This is according to
`svn co --help`.

[[
Reject checkout to existing paths without force

* subversion/svn/checkout-cmd.c:
  - (svn_cl__checkout): Reject checkout to existing directory
    without --force
]]

Regards
-- 
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
diff --git a/subversion/svn/checkout-cmd.c b/subversion/svn/checkout-cmd.c
index 56fd02b..5fda44a 100644
--- a/subversion/svn/checkout-cmd.c
+++ b/subversion/svn/checkout-cmd.c
@@ -155,6 +155,20 @@ svn_cl__checkout(apr_getopt_t *os,
                                        subpool);
         }
 
+      if (! opt_state->force)
+        {
+          svn_node_kind_t kind;
+
+          SVN_ERR(svn_io_check_path(target_dir, &kind, subpool));
+
+          if (kind != svn_node_none)
+            {
+              return svn_error_createf
+                (SVN_ERR_ILLEGAL_TARGET, NULL,
+                 _("Rejecting checkout to existing directory '%s'"), target_dir);
+            }
+        }
+
       /* Checkout doesn't accept an unspecified revision, so default to
          the peg revision, or to HEAD if there wasn't a peg. */
       if (revision.kind == svn_opt_revision_unspecified)

Attachment: signature.asc
Description: PGP signature

Reply via email to