]> git.eshelyaron.com Git - emacs.git/commitdiff
vc-next-action: Offer to delete missing files
authorSean Whitton <spwhitton@spwhitton.name>
Sun, 8 Jun 2025 10:22:28 +0000 (11:22 +0100)
committerEshel Yaron <me@eshelyaron.com>
Sun, 8 Jun 2025 19:21:31 +0000 (21:21 +0200)
* lisp/vc/vc.el (vc-next-action): Call vc-delete-file on a set
of missing files, to move them to the 'removed' state, instead
of just erroring out.

(cherry picked from commit 9b4fec7a97c9969452f048c0f851aca2b5914b74)

lisp/vc/vc.el

index 86eed61f70fcb26b358e33dd7827d93b2f3e19cc..0540bee238732a96200300c4a230ee6965f44053 100644 (file)
@@ -1423,9 +1423,8 @@ To apply VC operations to multiple files, the files must be in similar VC states
 (defun vc-next-action (verbose)
   "Do the next logical version control operation on the current fileset.
 This requires that all files in the current VC fileset be in the
-same state.  If they are not, signal an error.  Also signal an error if
-files in the fileset are missing (removed, but tracked by version control),
-or are ignored by the version control system.
+sufficiently similar states.  If they are not, signal an error.
+Also signal an error if files in the fileset are ignored by the VCS.
 
 For modern merging-based version control systems:
   If every file in the fileset is not registered for version
@@ -1486,8 +1485,6 @@ from which to check out the file(s)."
 
     ;; Do the right thing.
     (cond
-     ((eq state 'missing)
-      (error "Fileset files are missing, so cannot be operated on"))
      ((eq state 'ignored)
       (error "Fileset files are ignored by the version-control system"))
      ;; Fileset comes from a diff-mode buffer, see
@@ -1500,6 +1497,8 @@ from which to check out the file(s)."
                (vc-register (cons backend (cdr vc-fileset)))))
             (t
              (vc-register vc-fileset))))
+     ((eq state 'missing)
+      (mapc #'vc-delete-file files))
      ;; Files are up-to-date, or need a merge and user specified a revision
      ((or (eq state 'up-to-date) (and verbose (eq state 'needs-update)))
       (cond