On 4/11/2017 3:24 PM, Thomas wrote:
This is actually one of the sources I based my exclusion list on.
I added other files too. I replaced all # characters at the beginning
of each line with semicolons, extracted the files like [Tt]umbs.db to
Thumbs.db and thumbs.db, saved it, and let my batch file create a
comma-separated list for the --ignore command line switch.
Which raises a documentation point. I just realized that the GLOB syntax
that fossil understands is more powerful than fossil's documentation
explicitly shows. The documentation is vague and only shows examples
using the star wildcard. But it can do more....
GLOB matching is implemented[1] (like many low level constructs) by
calling into SQLite. In this case, the SQLite GLOB operator is used to
do the match. The SQLite documentation[2] says "The GLOB operator is
similar to LIKE but uses the Unix file globbing syntax for its
wildcards. Also, GLOB is case sensitive, unlike LIKE. .... The infix
GLOB operator is implemented by calling the function glob(Y,X) and can
be modified by overriding that function."
It also says[3] "The glob(X,Y) function is equivalent to the expression
"Y GLOB X". Note that the X and Y arguments are reversed in the glob()
function relative to the infix GLOB operator. If the
sqlite3_create_function() interface is used to override the glob(X,Y)
function with an alternative implementation then the GLOB operator will
invoke the alternative implementation."
It doesn't actually define what it meant by "Unix file globbing syntax",
but one could easily assume that meant the obvious use of '*' and '?'.
But all Unix shells also support character classes, and some support
even more features that could be lumped in with globbing (such as '~'
for $HOME). Various on-line tutorials (not official SQLite
documentation) say that [abc] character classes work too. I had to
resort to the SQLite source to find a definitive definition[4]:
Globbing rules:
'*' Matches any sequence of zero or more characters.
'?' Matches exactly one character.
[...] Matches one character from the enclosed list of
characters.
[^...] Matches one character not in the enclosed list.
With the [...] and [^...] matching, a ']' character can be included
in the list by making it the first character after '[' or '^'. A
range of characters can be specified using '-'. Example:
"[a-z]" matches any single lower-case letter. To match a '-', make
it the last character in the list.
So the examples from the gitignore project can be used as is if comments
are stripped out. Adding support for comments to the glob parser in
fossil might not be that difficult, I may look into that if I get time
as it is something I've wanted in the past.You mentioned changing the
git comments into semicolons. I'm not sure that does anything at all in
fossil. If it does, that should be documented too.
Something I definitely will do (unless another developer beats me to the
punch) is figure out a good place to drop the definition of what a glob
can be into the documentation. There's probably more than one place that
makes sense, but I don't want to repeat it in every command that
mentions supporting one of the glob settings or has an option that uses
a glob, so I'm looking for the sensible best place to put it.
[1]: https://www.fossil-scm.org/index.html/artifact/2209933ddc94df7e
[2]: https://sqlite.org/lang_expr.html
[3]: https://sqlite.org/lang_corefunc.html#glob
[4]: http://www.sqlite.org/src/artifact/9d52522cc8ae7f5c?ln=616-631
--
Ross Berteig r...@cheshireeng.com
Cheshire Engineering Corp. http://www.CheshireEng.com/
+1 626 303 1602
_______________________________________________
fossil-users mailing list
fossil-users@lists.fossil-scm.org
http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users