From a43cded2b7562c090cca73886ec3cd4a4b8afdd1 Mon Sep 17 00:00:00 2001 From: Sean Whitton Date: Sun, 8 Jun 2025 11:22:28 +0100 Subject: [PATCH] vc-next-action: Offer to delete missing files * 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 | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el index 86eed61f70f..0540bee2387 100644 --- a/lisp/vc/vc.el +++ b/lisp/vc/vc.el @@ -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 -- 2.39.5