Skip to content

Commit

Permalink
pathspec 0.9.0 quickfix (iterative#6689)
Browse files Browse the repository at this point in the history
* pathspec 0.9.0 quickfix

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* restrict requirement properly

Co-authored-by: Gao <[email protected]>

* revert change_rule update

* adjust tests to pathspec 0.9.0

* lower bound restrict pathspec

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Gao <[email protected]>
Co-authored-by: Saugat Pachhai (सौगात) <[email protected]>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
  • Loading branch information
5 people authored Oct 14, 2021
1 parent a1b1466 commit 2a3a933
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 23 deletions.
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ install_requires =
ruamel.yaml>=0.17.11
toml>=0.10.1
funcy>=1.14
pathspec>=0.6.0,<0.9.0
pathspec>=0.9.0,<0.10.0
shortuuid>=0.5.0
tqdm>=4.45.0,<5
packaging>=19.0
Expand Down
44 changes: 22 additions & 22 deletions tests/unit/test_pathspec_math.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,62 +10,62 @@
("#comment", "/dir", "#comment"),
# Put a backslash ("\") in front of the first hash for patterns that
# begin with a hash.
("\\#hash", "/dir", "/dir/**/#hash"),
("\\#hash", "/#dir", "/#dir/**/#hash"),
("\\#hash", "/dir", "dir/**/#hash"),
("\\#hash", "/#dir", "#dir/**/#hash"),
# Trailing spaces are ignored unless they are quoted with
# backslash ("\").
(" space", "/dir", "/dir/**/space"),
("\\ space", "/dir", "/dir/**/ space"),
(" space", "/dir", "dir/**/space"),
("\\ space", "/dir", "dir/**/ space"),
# An optional prefix "!" which negates the pattern;
("!include", "/dir", "!/dir/**/include"),
# Put a backslash ("\") in front of the first "!" for patterns that
# begin with a literal "!", for example, "\!important!.txt".
("\\!important!.txt", "/dir", "/dir/**/!important!.txt"),
("\\!important!.txt", "/dir", "dir/**/!important!.txt"),
# If there is a separator at the beginning or middle (or both) of the
# pattern, then the pattern is relative to the directory level of the
# particular .gitignore file itself.
("/separator.txt", "/dir", "/dir/separator.txt"),
("subdir/separator.txt", "/dir", "/dir/subdir/separator.txt"),
("/separator.txt", "/dir", "dir/separator.txt"),
("subdir/separator.txt", "/dir", "dir/subdir/separator.txt"),
# Otherwise the pattern may also match at any level below
# the .gitignore level.
("no_sep", "/dir", "/dir/**/no_sep"),
("no_sep", "/dir", "dir/**/no_sep"),
# If there is a separator at the end of the pattern then the pattern
# will only match directories, otherwise the pattern can match both
# files and directories.
("doc/fortz/", "/dir", "/dir/doc/fortz/"),
("fortz/", "/dir", "/dir/**/fortz/"),
("doc/fortz/", "/dir", "dir/doc/fortz/"),
("fortz/", "/dir", "dir/**/fortz/"),
# An asterisk "*" matches anything except a slash.
("*aste*risk*", "/dir", "/dir/**/*aste*risk*"),
("*aste*risk*", "/dir", "dir/**/*aste*risk*"),
# The character "?" matches any one character except "/".
("?fi?le?", "/dir", "/dir/**/?fi?le?"),
("?fi?le?", "/dir", "dir/**/?fi?le?"),
# The range notation, e.g. [a-zA-Z], can be used to match one of the
# characters in a range. See fnmatch(3) and the FNM_PATHNAME flag
# for a more detailed description.
("[a-zA-Z]file[a-zA-Z]", "/dir", "/dir/**/[a-zA-Z]file[a-zA-Z]"),
("[a-zA-Z]file[a-zA-Z]", "/dir", "dir/**/[a-zA-Z]file[a-zA-Z]"),
# Two consecutive asterisks ("**") in patterns matched against full
# pathname may have special meaning:
# A leading "**" followed by a slash means match in all directories.
# For example, "**/foo" matches file or directory "foo" anywhere,
# the same as pattern "foo".
("**/foo", "/dir", "/dir/**/foo"),
("**/foo", "/dir", "dir/**/foo"),
# "**/foo/bar" matches file or directory "bar" anywhere that is
# directly under directory "foo".
("**/foo/bar", "/dir", "/dir/**/foo/bar"),
("**/foo/bar", "/dir", "dir/**/foo/bar"),
# A trailing "/**" matches everything inside.
# For example, "abc/**" matches all files inside directory "abc",
# relative to the location of the .gitignore file, with infinite depth.
("abc/**", "/dir", "/dir/abc/**"),
("abc/**", "/dir", "dir/abc/**"),
# A slash followed by two consecutive asterisks then a slash matches
# zero or more directories. For example, "a/**/b"
# matches "a/b", "a/x/b", "a/x/y/b" and so on.
("a/**/b", "/dir", "/dir/a/**/b"),
("a/**/b", "/dir", "dir/a/**/b"),
# Other consecutive asterisks are considered regular asterisks and
# will match according to the previous rules.
("/***.txt", "/dir", "/dir/***.txt"),
("data/***", "/dir", "/dir/data/***"),
("***/file.txt", "/dir", "/dir/***/file.txt"),
("***file", "/dir", "/dir/**/***file"),
("a/***/b", "/dir", "/dir/a/***/b"),
("/***.txt", "/dir", "dir/***.txt"),
("data/***", "/dir", "dir/data/***"),
("***/file.txt", "/dir", "dir/***/file.txt"),
("***file", "/dir", "dir/**/***file"),
("a/***/b", "/dir", "dir/a/***/b"),
],
)
def test_dvcignore_pattern_change_dir(tmp_dir, patterns, dirname, changed):
Expand Down

0 comments on commit 2a3a933

Please sign in to comment.