jelmer / dulwich

Pure-Python Git implementation
https://www.dulwich.io/
Other
2.06k stars 395 forks source link

ignore: Doesn't match git check-ignore when pattern contains slash at beggining and end. #972

Open daavoo opened 2 years ago

daavoo commented 2 years ago
$ cat .gitignore 
/data/
$ git check-ignore data -v
.gitignore:1:/data/ data
$ python
>>> from dulwich import ignore
>>> a = ignore.IgnoreFilter((ignore.read_ignore_patterns(open(".gitignore", "rb"))))
>>> a.is_ignored("data")
>>> a.is_ignored("data/")
True

Originally posted by @daavoo in https://github.com/iterative/dvc/issues/7815#issuecomment-1139442721

jelmer commented 2 years ago

Help with this would be great. The first step is probably to add an entry to dulwich/tests/test_ignore.py reproducing this test case.