GNU bug report logs -
#37189
25.4.1: vc-hg-ignore implementation is missing
Previous Next
Full log
View this message in rfc822 format
Let me clarify this one last time.
> The "pattern" use case is not the "wildcard" use case. "pattern" is an unspecified string, while "wildcard" is backend specific. For SVN it is a glob(7) expression without subdirectories (otherwise it does not match anything).
>
"pattern" is a generic term, which does not imply a specific syntax.
"wildcard specification" is a pattern following the rules of a glob(7)
syntax variant.
"regexp pattern" implies one of the regular expression syntaxes
(regex(7), Emacs, Perl, Python, ...).
Citing from 4.2.1. file pathes are not patterns (http://sw-amt.ws/emacs/doc/_build/html/emacs-vc-ignore-feature.html#file-pathes-are-not-patterns):
Assuming that a file path is always a pattern that matches the
file path unambiguously is simply wrong.
When ignoring a specific file path and nothing but that file
path, a pattern must be constructed that matches the file path
exactly. The syntax for this pattern is backend specific and the
pattern is generally not the file path itself. In other words: it
is an exception that a file path and the exactly matching pattern
are identical strings. Specifically, if a file path contains a
character with special meaning in the pattern syntax, then the
matching pattern cannot be identical to the file path since the
special character must be escaped.
+-------------+-----------------+---------------+-----------------+--------------------+
| `file path` | glob(7) | anchored glob | Hg `regex` | Bzr `regex` |
+=============+=================+===============+=================+====================+
| test[56].xx | test\[56].xx | /test\[56].xx | ^test\[56]\.xx$ | RE:^test\[56]\.xx$ |
| | test[[]56].xx | | | |
+-------------+-----------------+---------------+-----------------+--------------------+
| simple.txt | simple.txt | /simple.txt | ^simple\.txt$ | RE:^simple\.txt$ |
| | simple[.]txt | | | |
+-------------+-----------------+---------------+-----------------+--------------------+
The correct escaping of FILE can only be determined by the
backend. Therefore neither vc-dir-ignore nor lisp code calling
vc-ignore can escape the FILE parameter correctly without support
from the backend. This makes pattern input for FILE only useful
during interactive calls.
Even, if it was magically possible to determine the correct
pattern in the frontend, submitting an anchored
glob "/some-sub/file.txt" to `vc-ignore` would be interpreted as
an absolute path.
In other words, the API specificaton
[...] FILE is a wildcard specification, either relative to
DIRECTORY or absolute.
which asks for implementing the pattern use case inextricably
mixed with the file path use case, is nonsense.
It also means, that all of the backend functions which currently
demand a pattern are absolutely useless.
Therefore the API change request is specifically:
(defun vc-ignore (file-or-pattern &optional directory remove as-is)
"Ignore FILE-OR-PATTERN under VCS of DIRECTORY.
DIRECTORY defaults to `default-directory' and is used to
determine the responsible VC backend.
When REMOVE is non-nil, remove FILE-OR-PATTERN from the list of
ignored files.
If AS-IS is nil, FILE-OR-PATTERN is considered a file path that
must be escaped and anchored. The directory name of
FILE-OR-PATTERN expanded against DIRECTORY is used to determine
the ignore file. The effective pattern consists of the file path
relative to the directory of the ignore file, properly escaped
and anchored by the VC backend.
If AS-IS is non-nil, FILE-OR-PATTERN is considered a pattern that
should not be modified. DIRECTORY is used to determine the
ignore file."
This bug report was last modified 4 years and 351 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.