Subject: Re: bug#39380: 26.3: Opening files in vc-dir-mode with differing root and working dir fails

From: Eli Zaretskii <[email-masked]>
Date: Sat, 08 Feb 2020 10:04:23 +0200

> Cc: [email-masked], [email-masked]
> From: Dmitry Gutov <[email-masked]>
> Date: Sat, 8 Feb 2020 04:20:26 +0300
> 
> On 07.02.2020 17:00, Eli Zaretskii wrote:
> >> Cc: [email-masked], [email-masked]
> >> From: Dmitry Gutov <[email-masked]>
> >> Date: Fri, 7 Feb 2020 14:03:21 +0300
> >>
> >> On 07.02.2020 12:53, Eli Zaretskii wrote:
> >>> I'll have to ask you to walk me through the change and explain how it
> >>> solves the original issue.
> >>
> >> There are two changes:
> >>
> >> 1. Having the returned file names relative to the working dir instead of
> >> the repository root. For that, we change 'hg status' to 'hg status re:'.
> > 
> > Why do we want the file names to be relative?  If default-directory of
> > the buffer is set correctly, that shouldn't be necessary, and if the
> > file names are absolute, then the default-directory doesn't even
> > matter much.
> 
> They are already relative, but against the repository root.
> 
> And people want to open vc-dir buffers in any directory, not just in 
> repository roots.

If I say "hg status" in a subdirectory, I by default get file names
relative to the root.  Wouldn't Mercurial users be surprised that
Emacs produces a different display?  (I understand that there's a
recent tendency to make it easier to produce relative file names, and
there's even a config option to make that the default, but I'm asking
whether we should force this behavior on users even if their
preference is not to.)

> We could force the file names to be absolute, and then pipe them through 
> file-relative-name, but that's just extra work.

I'm more bothered by the user-facing changes in this respect than by
algorithmic details.  Would it work to set the default-directory of
the buffer to the repository's root instead? would that solve the
original problem?

If setting the default-directory could be a solution, I'd prefer doing
that on the release branch, so that user-facing behavior is unchanged.
We could then make changes on master to offer a defcustom that is
parallel to the commands.status.relative config setting, and if that's
set to prefer relative names, use your modified code.  WDYT?

> > This change should be in NEWS, IMO.
> 
> It's a bugfix for an older, unintended change. It's not a new behavior.

It changes how files are presented to the user, so I think it has
user-visible effects that should be mentioned in NEWS.

> > Also, is DIR guaranteed to be the directory where FILES live?
> 
> Yes, see the description of dir-status-files in the top commentary in vc.el.

Thanks.

What about this question:

> you are saying that "C-x v d" in a subdirectory of the root of a
> Mercurial repository became broken in Emacs 25.1?