vc-dir-recompute-file-state: Change directory to DEF-DIR

* lisp/vc/vc-dir.el (vc-dir-recompute-file-state): Change
directory to DEF-DIR before calling into the backend.
* test/lisp/vc/vc-tests/vc-test-misc.el
(vc-test-vc-dir-on-symlink): Test that the file has the right
state.
This commit is contained in:
Sean Whitton 2026-06-10 13:36:52 +01:00
parent 47bdbc8d85
commit cd84bd6a0c
2 changed files with 8 additions and 6 deletions

View file

@ -1275,9 +1275,10 @@ that file."
;; FIXME: Warning: UGLY HACK. The CVS backend caches the state ;; FIXME: Warning: UGLY HACK. The CVS backend caches the state
;; info, this forces the backend to update it. ;; info, this forces the backend to update it.
(vc-call-backend vc-dir-backend 'registered fname)) (vc-call-backend vc-dir-backend 'registered fname))
(let ((state (vc-call-backend vc-dir-backend 'state fname)) (let ((default-directory def-dir)
(state (vc-call-backend vc-dir-backend 'state fname-short))
(extra (vc-call-backend vc-dir-backend (extra (vc-call-backend vc-dir-backend
'status-fileinfo-extra fname))) 'status-fileinfo-extra fname-short)))
;; Ensure we return a nil state if the file does not exist and is ;; Ensure we return a nil state if the file does not exist and is
;; not tracked so that it disappears from VC-Dir (bug#81191). ;; not tracked so that it disappears from VC-Dir (bug#81191).
(if (and (eq state 'up-to-date) (not (file-exists-p fname))) (if (and (eq state 'up-to-date) (not (file-exists-p fname)))

View file

@ -292,10 +292,11 @@ See bug#80803 and bug#80967."
(basic-save-buffer)) (basic-save-buffer))
(dolist (buf (list truename-dir symlink-dir)) (dolist (buf (list truename-dir symlink-dir))
(with-current-buffer buf (with-current-buffer buf
(should (equal (vc-dir-fileinfo->name (let ((data (ewoc-data (ewoc-nth vc-ewoc 1))))
(ewoc-data (should (equal (vc-dir-fileinfo->name data)
(ewoc-nth vc-ewoc 1))) (file-name-nondirectory file)))
(file-name-nondirectory file)))))))))) (should (equal (vc-dir-fileinfo->state data)
'edited))))))))))
(provide 'vc-test-misc) (provide 'vc-test-misc)
;;; vc-test-misc.el ends here ;;; vc-test-misc.el ends here