From cd84bd6a0c124514350500fa0ae2b730c1cca9fd Mon Sep 17 00:00:00 2001 From: Sean Whitton Date: Wed, 10 Jun 2026 13:36:52 +0100 Subject: [PATCH] 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. --- lisp/vc/vc-dir.el | 5 +++-- test/lisp/vc/vc-tests/vc-test-misc.el | 9 +++++---- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/lisp/vc/vc-dir.el b/lisp/vc/vc-dir.el index f0f035362c9..7384cc81869 100644 --- a/lisp/vc/vc-dir.el +++ b/lisp/vc/vc-dir.el @@ -1275,9 +1275,10 @@ that file." ;; FIXME: Warning: UGLY HACK. The CVS backend caches the state ;; info, this forces the backend to update it. (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 - 'status-fileinfo-extra fname))) + 'status-fileinfo-extra fname-short))) ;; 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). (if (and (eq state 'up-to-date) (not (file-exists-p fname))) diff --git a/test/lisp/vc/vc-tests/vc-test-misc.el b/test/lisp/vc/vc-tests/vc-test-misc.el index 853f22545a6..066c49df324 100644 --- a/test/lisp/vc/vc-tests/vc-test-misc.el +++ b/test/lisp/vc/vc-tests/vc-test-misc.el @@ -292,10 +292,11 @@ See bug#80803 and bug#80967." (basic-save-buffer)) (dolist (buf (list truename-dir symlink-dir)) (with-current-buffer buf - (should (equal (vc-dir-fileinfo->name - (ewoc-data - (ewoc-nth vc-ewoc 1))) - (file-name-nondirectory file)))))))))) + (let ((data (ewoc-data (ewoc-nth vc-ewoc 1)))) + (should (equal (vc-dir-fileinfo->name data) + (file-name-nondirectory file))) + (should (equal (vc-dir-fileinfo->state data) + 'edited)))))))))) (provide 'vc-test-misc) ;;; vc-test-misc.el ends here