Subject: Re: bug#37189: 25.4.1: vc-hg-ignore implementation is missing

From: Wolfgang Scherer <[email-masked]>
Date: Sat, 8 Feb 2020 20:45:34 +0100

Am 08.02.20 um 10:57 schrieb Dmitry Gutov:
> On 07.02.2020 12:57, Eli Zaretskii wrote:
>> AFAIU, Dmitry oversees the VC development and maintenance.  That
>> includes the issues you raised here.
>
> That's right. And I asked some questions before in this report and didn't get direct answers.

I answered as best as I could up to the point, where it became clear to me that the entire ignore feature has fatal design flaws which need to be addressed, if silly hacks (like this one) are to be avoided.

The status quo before Emacs 27 is:

1. The argument FILE of `vc-ignore` is documented to accept a wildcard specification. This is the use case "pattern".

2. `vc-ignore` is called from `vc-dir-ignore` with either an absolute or relative filename. This is the use case "file path".

3. Some backends expect a file path, some backends expect a pattern. This cannot be fixed without adding a parameter to `vc-ignore`, `vc-<backend>-ignore`.

+-----------------------+-------------+-----------+
| function              | file path   | pattern   |
+=======================+=============+===========+
| :func:`vc-ignore`     | strong hint | yes       |
+-----------------------+-------------+-----------+
| :func:`vc-dir-ignore` | mandatory   | no        |
+-----------------------+-------------+-----------+
| :func:`vc-cvs-ignore` | no          | mandatory |
+-----------------------+-------------+-----------+
| :func:`vc-svn-ignore` | mandatory   | no        |
+-----------------------+-------------+-----------+
| :func:`vc-src-ignore` | --          | --        |
+-----------------------+-------------+-----------+
| :func:`vc-bzr-ignore` | no          | mandatory |
+-----------------------+-------------+-----------+
| :func:`vc-git-ignore` | no          | mandatory |
+-----------------------+-------------+-----------+
| :func:`vc-hg-ignore`  | no          | mandatory |
+-----------------------+-------------+-----------+
| :func:`vc-mtn-ignore` | --          | --        |
+-----------------------+-------------+-----------+

>
> To be clear, I'm quite happy with the meat of the patch presented here,
I am not. The attempt to support a dual API with file/pattern pseudo-detection is just shameful.
> just suspicious of the not well-enough documented change in vc-ignore's semantics. So yeah, we need a better understanding of the problem and maybe a better design.

I have documented the environment, the rationale and the ongoing implementation extensively at http://sw-amt.ws/emacs/doc/_build/html/emacs-vc-ignore-feature.html. The core topic is "File pathes are NOT patterns", so they must be separated in the API.

> Hopefully one that's not too different from the current one.

The current one is completely broken but the necessary changes are only few. Since it hasn't worked to begin with, there is really nothing to preserve.

I have already implemented the core handler `vc-default-ignore` replacing the defunct handlers for CVS, Git, Hg, Bzr by parameter sets. The additional parameter set for SRC is also available. I am planning on implementing Mtn. I do not plan on implementing or fixing SVN (or maybe I will).

Search on page http://sw-amt.ws/emacs/doc/_build/html/emacs-vc-ignore-feature.html for x-vc-repair.el,which is a link to the ongoing implementation. With `eval-buffer` under Emacs 24 - 26, the feature is activated.

The user interface for ignoring files is`C-x v F` or `F` in `vc-dir-mode`. It behaves like other functions, e.g. `C-x v i`, `C-x v u`, `C-x v =`. I.e., it is possible to select multiple files to ignore in `vc-dir-mode` and `dired-mode`.

>
> I'll read the whole of the discussion as soon as I can, but it's going to take some time to digest, sorry.
Please, do not read this discussion, as it has became chaotic before I realized what is required to understand the problem.
>
>> It's up to Dmitry, really.  If he feels my attempt to understand the
>> design critique you present is not helping, then I'll gladly leave it
>> to him to continue with this report.
>
> Quite the opposite. If you reach some mutual understanding, it will surely help me when reading this thread a bit later.

I would really like to close this thread and open one about the correct implementation of `vc-ignore`.