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

From: Dmitry Gutov <[email-masked]>
Date: Fri, 20 Mar 2020 01:42:45 +0200

Hi Wolfgang,

On 25.02.2020 04:22, Wolfgang Scherer wrote:
> I would like to discuss overall strategy first.  Since I have a fully
> working implementation for all supported backends at
> https://github.com/wolfmanx/vc-ign  that does not interfere with the
> current vc commands, it would be helpful, if you could load it and
> evaluate the use cases 'z i' and 'z p' in 'vc-dir-mode', 'C-x v z i'
> and 'C-x v z p' in 'dired-mode' and in a file buffer, just to see if
> we can agree on a direction before discussing details.

I've read the patch you posted to this discussion, and there are some 
definitely good things in there, but I wonder if we can make some 
progress first without redoing everything quite as much.

The majority of backends don't support regexp ignores (AFAIK), so maybe 
it's not worth bringing that notion at the top of the API. If we can let 
individual backends handle this case in their implementations correctly, 
that would be better. Then the ignore-param-regexp and ignore-param 
generics might not be necessary. Though we could add some other(s).

> I think a good point to start is the elimination of all
> backend-specific 'vc-ignore' implementations ('vc-cvs-ignore',
> 'vc-svn-ignore').  That is one goal which is easily achievable.  The
> benefit is a uniform implementation across all backends with
> 'vc-default-ignore' as the central implementation of algorithms,
> without duplication of code in backends.

First: the name of 'vc-default-ignore' itself implies that there have to 
be backend-specific implementations. That's what the -default- in the 
name is for. Likewise for vc-default-get-ignore-file-and-pattern.

Some other thoughts:

* Why go to this much indirection with 'ignore-param' when we could have 
a backend method that would escape and anchor file name? It doesn't look 
like that option would take more code.

* Since when AS-IS is t vc-default-get-ignore-file-and-pattern is not 
doing much, maybe vc-ignore-file and vc-ignore-file shouldn't carry this 
distinction this long through the call stack.

If vc-ignore-file calls a backend method that turns the file name into a 
pattern which doesn't need any further special handling, it even could 
call vc-ignore-pattern with the resulting value.

* Shouldn't vc-ignore-fileset takes the fileset and loop through it 
calling vc-ignore-file with each value?