1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-05-10 15:25:04 -07:00

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 e05fab5775
   Author: Stephen Berman <stephen.berman@gmx.net>
   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.
This commit is contained in:
João Távora 2026-05-07 22:06:45 +01:00
parent 8d0bf280a6
commit 48b064a2aa

View file

@ -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)