From 48b064a2aa3bb25137c31aac9994cd2d36fe71c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20T=C3=A1vora?= Date: Thu, 7 May 2026 22:06:45 +0100 Subject: [PATCH] Fix 'vc-dir-resynch-file' again (bug#80967) This unbreak project-vc-dir for dirs under non-truename hierarchies. The following commit presumably makes 'M-x vc-dir' usable again for versioned directories inside non-truename hierarchies, commit e05fab5775c96f8f88eab8d75dea40253bfb78eb Author: Stephen Berman Date: Sat May 2 15:11:37 2026 +0200 Fix 'vc-dir-resynch-file' (bug#80803) * lisp/vc/vc-dir.el (vc-dir-resynch-file): Apply 'file-truename' instead of 'expand-file-name' to FNAME argument to prevent spurious display of symlinked files in *vc-dir* buffer. However the similar command 'M-x project-vc-dir' was broken and made unusable in similar circumstances. This relatively simple fix addresses both situations touching only the problematic 'vc-resynch-file' and one of its callees, 'vc-dir-recompute-file-state', which now discerns clearly between the short/familiar name to present in the list and the "fname" to use to call into the backend to gather the VC state. Since this function is also called from another context, where the requirements are less clear, keeping current smenatics in that situation seemed prudent, so the new behaviour is activate with a new optional parameter. * lisp/vc/vc-dir.el (vc-dir-resynch-file): Call vc-dir-recompute-file-state with truename=t. (vc-dir-recompute-file-state): Accept optional truename param. --- lisp/vc/vc-dir.el | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/lisp/vc/vc-dir.el b/lisp/vc/vc-dir.el index 21658312a13..3c9222d725f 100644 --- a/lisp/vc/vc-dir.el +++ b/lisp/vc/vc-dir.el @@ -1261,8 +1261,12 @@ that file." (vc-dir-fileinfo->state crt-data)) result)) (nreverse result))) -(defun vc-dir-recompute-file-state (fname def-dir) - (let* ((file-short (file-relative-name fname def-dir)) +(defun vc-dir-recompute-file-state (fname def-dir &optional truename) + "Compute state of FNAME known to live inside DEF-DIR. +If TRUENAME is non-nil, FNAME is a truename, DEF-DIR not necessarily." + (let* ((file-short (file-relative-name + fname (if truename (file-truename def-dir) def-dir))) + (fname (if truename (expand-file-name file-short def-dir) fname)) (_remove-me-when-CVS-works (when (eq vc-dir-backend 'CVS) ;; FIXME: Warning: UGLY HACK. The CVS backend caches the state @@ -1330,7 +1334,11 @@ that file." (vc-dir-resync-directory-files file) (ewoc-set-hf vc-ewoc (vc-dir-headers vc-dir-backend ddir) "")) - (let* ((complete-state (vc-dir-recompute-file-state file ddir)) + (let* ((complete-state + ;; Make sure 'vc-dir-recompute-file-state' + ;; knows about the truename nature of 'file' + ;; (bug#80967). + (vc-dir-recompute-file-state file ddir t)) (state (cadr complete-state))) (vc-dir-update (list complete-state)