...
1# go-pathspec
2
3[](https://github.com/shibumi/go-pathspec/actions?query=workflow%3Abuild) [](https://coveralls.io/github/shibumi/go-pathspec) [](https://pkg.go.dev/github.com/shibumi/go-pathspec)
4
5go-pathspec implements gitignore-style pattern matching for paths.
6
7## Alternatives
8
9There are a few alternatives, that try to be gitignore compatible or even state
10gitignore compatibility:
11
12### https://github.com/go-git/go-git
13
14go-git states it would be gitignore compatible, but actually they are missing a few
15special cases. This issue describes one of the not working patterns: https://github.com/go-git/go-git/issues/108
16
17What does not work is global filename pattern matching. Consider the following
18`.gitignore` file:
19
20```gitignore
21# gitignore test file
22parse.go
23```
24
25Then `parse.go` should match on all filenames called `parse.go`. You can test this via
26this shell script:
27```shell
28mkdir -p /tmp/test/internal/util
29touch /tmp/test/internal/util/parse.go
30cd /tmp/test/
31git init
32echo "parse.go" > .gitignore
33```
34
35With git `parse.go` will be excluded. The go-git implementation behaves different.
36
37### https://github.com/monochromegane/go-gitignore
38
39monochromegane's go-gitignore does not support the use of `**`-operators.
40This is not consistent to real gitignore behavior, too.
41
42## Authors
43
44Sander van Harmelen (<sander@xanzy.io>)
45Christian Rebischke (<chris@shibumi.dev>)
View as plain text