Skip to content

gitignore-style pathspec pattern matching in Go

License

Apache-2.0, BSD-3-Clause licenses found

Licenses found

Apache-2.0
LICENSE
BSD-3-Clause
GO-LICENSE
Notifications You must be signed in to change notification settings

shibumi/go-pathspec

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

go-pathspec

test Coverage Status PkgGoDev

go-pathspec implements gitignore-style pattern matching for paths.

Alternatives

There are a few alternatives, that try to be gitignore compatible or even state gitignore compatibility:

go-git states it would be gitignore compatible, but actually they are missing a few special cases. This issue describes one of the not working patterns: go-git/go-git#108

What does not work is global filename pattern matching. Consider the following .gitignore file:

# gitignore test file
parse.go

Then parse.go should match on all filenames called parse.go. You can test this via this shell script:

mkdir -p /tmp/test/internal/util
touch /tmp/test/internal/util/parse.go
cd /tmp/test/
git init
echo "parse.go" > .gitignore

With git parse.go will be excluded. The go-git implementation behaves different.

monochromegane's go-gitignore does not support the use of **-operators. This is not consistent to real gitignore behavior, too.

Authors

Sander van Harmelen (sander@xanzy.io)
Christian Rebischke (chris@shibumi.dev)

About

gitignore-style pathspec pattern matching in Go

Topics

Resources

License

Apache-2.0, BSD-3-Clause licenses found

Licenses found

Apache-2.0
LICENSE
BSD-3-Clause
GO-LICENSE

Stars

Watchers

Forks

Packages

No packages published

Languages