]> git.eshelyaron.com Git - emacs.git/commitdiff
Check if package already exists before installing from checkout
authorPhilip Kaludercic <philipk@posteo.net>
Fri, 9 Dec 2022 18:54:25 +0000 (19:54 +0100)
committerPhilip Kaludercic <philipk@posteo.net>
Sat, 10 Dec 2022 08:48:02 +0000 (09:48 +0100)
* lisp/emacs-lisp/package-vc.el (package-vc-install-from-checkout):
Copy check from 'package-vc--unpack'.

lisp/emacs-lisp/package-vc.el

index 80d268c29589934cd2d439901d3c7bd34f959a34..cf9b98308f1b6bf2d0dccd91d14c9d9227d3d31d 100644 (file)
@@ -754,6 +754,10 @@ name from the base name of DIR."
   (package-vc--archives-initialize)
   (let* ((name (or name (file-name-base (directory-file-name dir))))
          (pkg-dir (expand-file-name name package-user-dir)))
+    (when (file-exists-p pkg-dir)
+      (if (yes-or-no-p (format "Overwrite previous checkout for package `%s'?" name))
+          (package--delete-directory pkg-dir)
+        (error "There already exists a checkout for %s" name)))
     (make-symbolic-link (expand-file-name dir) pkg-dir)
     (package-vc--unpack-1
      (package-desc-create