GNU bug report logs - #39380
26.3: Opening files in vc-dir-mode with differing root and working dir fails

Previous Next

Package: emacs;

Reported by: Wolfgang Scherer <Wolfgang.Scherer <at> gmx.de>

Date: Sat, 1 Feb 2020 00:14:01 UTC

Severity: normal

Found in version 26.3

Fixed in version 27.1

Done: Dmitry Gutov <dgutov <at> yandex.ru>

Bug is archived. No further changes may be made.

Full log


Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Wolfgang Scherer <Wolfgang.Scherer <at> gmx.de>
To: Emacs Bugs <bug-gnu-emacs <at> gnu.org>
Subject: 26.3: Opening files in vc-dir-mode with differing root and working
 dir fails
Date: Sat, 1 Feb 2020 01:13:39 +0100
Here is another per-tree/per-directory bug, I just found:

1. Prepare a Mercurial repository `check-hgs` with sub directories `sub1`
   and `sub2` and the files `sub1/a`, `sub2/x`,

   .. code-block:: sh

      mkdir -p check-hgs/sub1 check-hgs/sub2
      touch check-hgs/sub1/a check-hgs/sub2/x
      cd check-hgs && hg init

2. Find file `check-hgs/sub1/a`.

3. Press `C-x v d RET`, which will show a "Working dir" different from "Root":

   .. code-block:: text

      Working dir: check-hgs/sub1/
      Root       : check-hgs

                           ./
                           sub1/
      unregistered         sub1/a
                           sub2/
      unregistered         sub2/x

4. Go to line

   "unregistered         sub2/x"

   and press `f`.

5. Press `C-x d`.

   The default directory is "check-hgs/sub1/sub2/", which is wrong. It
   should be "check-hgs/sub2/".

The problem results from the call to `expand-file-name` in
`vc-dir-current-file`, which uses the default directory, but
`vc-dir-fileinfo->name` delivers a filename relative to the root
directory.

.. code-block:: elisp

   (defun vc-dir-current-file ()
     (let ((node (ewoc-locate vc-ewoc)))
       (unless node
     (error "No file available"))
       (expand-file-name (vc-dir-fileinfo->name (ewoc-data node)))))


However, modifying `vc-dir-current-file` does not solve the problem,
since all other invocations of `vc-dir-fileinfo->name` ultimately
suffer from the same deficiency.

It is IMHO better to remove the hybrid state of `vc-dir-mode`, where
the default directory is different from the root directory.
“

This bug report was last modified 5 years and 96 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.