aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSean Whitton2026-02-14 15:29:07 +0000
committerSean Whitton2026-02-14 15:29:07 +0000
commit768c68942e89ba2ad46f08dc0148cd663f59c8b3 (patch)
treee4880f6c6e39dd9f8aa2044053c9d646f87289cd
parentbc763572a9c5e9e8bd06467c1052f5372968e59c (diff)
downloademacs-768c68942e89ba2ad46f08dc0148cd663f59c8b3.tar.gz
emacs-768c68942e89ba2ad46f08dc0148cd663f59c8b3.zip
Fix vc-pull from buffers visiting untracked files
* lisp/vc/vc.el (vc-pull): Don't fail when called from buffers visiting unregistered or ignored files so long as there is a 'pull' function available from the backend.
-rw-r--r--lisp/vc/vc.el26
1 files changed, 19 insertions, 7 deletions
diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el
index 85f059df573..7a0e0c354a2 100644
--- a/lisp/vc/vc.el
+++ b/lisp/vc/vc.el
@@ -4668,13 +4668,25 @@ file, this simply replaces the work file with the latest revision
4668on its branch. If the file contains changes, any changes in the 4668on its branch. If the file contains changes, any changes in the
4669tip revision are merged into the working file." 4669tip revision are merged into the working file."
4670 (interactive "P") 4670 (interactive "P")
4671 (let* ((vc-fileset (vc-deduce-fileset t)) 4671 (let (backend files fn)
4672 (backend (car vc-fileset)) 4672 (condition-case ret (vc-deduce-fileset 'not-state-changing)
4673 (files (cadr vc-fileset))) 4673 (error
4674 ;; If `vc-deduce-fileset' failed then try again with
4675 ;; ALLOW-UNREGISTERED non-nil, but in this case we require a
4676 ;; `pull' function because that doesn't need a list of files.
4677 (unless
4678 (setq fn
4679 (and-let* ((fileset (vc-deduce-fileset 'not-state-changing
4680 'allow-unregistered)))
4681 (vc-find-backend-function (car fileset) 'pull)))
4682 (signal (car ret) (cdr ret))))
4683 (:success
4684 (setq backend (car ret) files (cadr ret)
4685 fn (vc-find-backend-function backend 'pull))))
4674 (cond 4686 (cond
4675 ;; If a pull operation is defined, use it. 4687 ;; If a pull operation is defined, use it.
4676 ((vc-find-backend-function backend 'pull) 4688 (fn
4677 (vc-call-backend backend 'pull arg) 4689 (funcall fn arg)
4678 ;; FIXME: Ideally we would only clear out the stored value for the 4690 ;; FIXME: Ideally we would only clear out the stored value for the
4679 ;; REMOTE-LOCATION from which we are pulling. 4691 ;; REMOTE-LOCATION from which we are pulling.
4680 (vc-run-delayed 4692 (vc-run-delayed
@@ -4687,14 +4699,14 @@ tip revision are merged into the working file."
4687 (let ((file (buffer-file-name))) 4699 (let ((file (buffer-file-name)))
4688 (and file (member file files)))))) 4700 (and file (member file files))))))
4689 (dolist (file files) 4701 (dolist (file files)
4690 (if (vc-up-to-date-p file) 4702 (if (vc-up-to-date-p file)
4691 (vc-checkout file t) 4703 (vc-checkout file t)
4692 (vc-maybe-resolve-conflicts 4704 (vc-maybe-resolve-conflicts
4693 file (vc-call-backend backend 'merge-news file))))) 4705 file (vc-call-backend backend 'merge-news file)))))
4694 ;; For a locking VCS, check out each file. 4706 ;; For a locking VCS, check out each file.
4695 ((eq (vc-checkout-model backend files) 'locking) 4707 ((eq (vc-checkout-model backend files) 'locking)
4696 (dolist (file files) 4708 (dolist (file files)
4697 (if (vc-up-to-date-p file) 4709 (if (vc-up-to-date-p file)
4698 (vc-checkout file t)))) 4710 (vc-checkout file t))))
4699 (t 4711 (t
4700 (error "VC update is unsupported for `%s'" backend))))) 4712 (error "VC update is unsupported for `%s'" backend)))))