Giter Site home page Giter Site logo

zealic / xignore Goto Github PK

View Code? Open in Web Editor NEW
6.0 4.0 4.0 36 KB

A golang package for pattern matching of file paths. Like gitignore, dockerignore chefignore.

Home Page: https://www.zealic.com/projects/xignore

License: MIT License

Go 99.72% Makefile 0.28%
golang gitignore ignorefile file-matching ignore

xignore's Introduction

.-') _   ('-.   ('-.                                 
  (  OO) )_(  OO) ( OO ).-.                             
,(_)----.(,------./ . --. / ,--.      ,-.-')   .-----.  
|       | |  .---'| \-.  \  |  |.-')  |  |OO) '  .--./  
'--.   /  |  |  .-'-'  |  | |  | OO ) |  |  \ |  |('-.  
(_/   /  (|  '--.\| |_.'  | |  |`-' | |  |(_//_) |OO  ) 
 /   /___ |  .--' |  .-.  |(|  '---.',|  |_.'||  |`-'|  
|        ||  `---.|  | |  | |      |(_|  |  (_'  '--'\  
`--------'`------'`--' `--' `------'  `--'     `-----'  

xignore's People

Contributors

gofrendiasgard avatar zealic avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

xignore's Issues

Matcher.Matches() fails with a basedir of "."

The Matcher.Matches method errors when given . as the basedir. This may be expected behaviour (and may well be desirable so that xignore doesn't need to call os.Getwd), but it's undocumented.

See hairyhenderson/gomplate#1082 for a bit of background on how I found it (and worked around it).

I'm not sure if this is something that xignore should handle, but it should at least be documented ๐Ÿ˜‰

Broken in Windows

Hi @zealic!

I'm trying to fix some long-standing bugs in the Windows build of gomplate, and it looks like xignore has some bugs too which are affecting this.

I've set up a temporary AppVeyor CI in my fork and you can see the build failure here (just running go test ./...: https://ci.appveyor.com/project/hairyhenderson/xignore/builds/23459048

I'll hack on it a bit to see if I can make it work.

Here's the log:

Build started
git config --global core.autocrlf input
git clone -q https://github.com/hairyhenderson/xignore.git c:\gopath\src\github.com\zealic\xignore
git fetch -q origin +refs/pull/1/merge:
git checkout -qf FETCH_HEAD
Running Install scripts
set PATH=%GOPATH%\bin;c:\go\bin;%PATH%
go version
go version go1.11 windows/amd64
go test -v ./... & IF ERRORLEVEL == 1 EXIT 1
=== RUN   TestMatches_Simple
--- PASS: TestMatches_Simple (0.00s)
=== RUN   TestMatches_Simple_WithBeforePatterns
--- PASS: TestMatches_Simple_WithBeforePatterns (0.00s)
=== RUN   TestMatches_Simple_WithAfterPatterns
--- PASS: TestMatches_Simple_WithAfterPatterns (0.00s)
=== RUN   TestMatches_Folder
--- FAIL: TestMatches_Folder (0.00s)
    require.go:157: 
        	Error Trace:	matcher_test.go:57
        	Error:      	Not equal: 
        	            	expected: []string{"foo/bar/1.txt"}
        	            	actual  : []string{}
        	            	
        	            	Diff:
        	            	--- Expected
        	            	+++ Actual
        	            	@@ -1,3 +1,2 @@
        	            	-([]string) (len=1) {
        	            	- (string) (len=13) "foo/bar/1.txt"
        	            	+([]string) {
        	            	 }
        	Test:       	TestMatches_Folder
=== RUN   TestMatches_Root
--- FAIL: TestMatches_Root (0.00s)
    require.go:157: 
        	Error Trace:	matcher_test.go:71
        	Error:      	Not equal: 
        	            	expected: []string{".xignore", "sub/1.txt", "sub/2.txt"}
        	            	actual  : []string{".xignore", "sub\\1.txt", "sub\\2.txt"}
        	            	
        	            	Diff:
        	            	--- Expected
        	            	+++ Actual
        	            	@@ -2,4 +2,4 @@
        	            	  (string) (len=8) ".xignore",
        	            	- (string) (len=9) "sub/1.txt",
        	            	- (string) (len=9) "sub/2.txt"
        	            	+ (string) (len=9) "sub\\1.txt",
        	            	+ (string) (len=9) "sub\\2.txt"
        	            	 }
        	Test:       	TestMatches_Root
=== RUN   TestMatches_Exclusion
--- FAIL: TestMatches_Exclusion (0.00s)
    require.go:157: 
        	Error Trace:	matcher_test.go:83
        	Error:      	Not equal: 
        	            	expected: []string{"e1.txt", "e3.txt", "en/e3.txt"}
        	            	actual  : []string{"e1.txt", "e3.txt"}
        	            	
        	            	Diff:
        	            	--- Expected
        	            	+++ Actual
        	            	@@ -1,5 +1,4 @@
        	            	-([]string) (len=3) {
        	            	+([]string) (len=2) {
        	            	  (string) (len=6) "e1.txt",
        	            	- (string) (len=6) "e3.txt",
        	            	- (string) (len=9) "en/e3.txt"
        	            	+ (string) (len=6) "e3.txt"
        	            	 }
        	Test:       	TestMatches_Exclusion
=== RUN   TestMatches_DisabledNested
--- FAIL: TestMatches_DisabledNested (0.00s)
    require.go:157: 
        	Error Trace:	matcher_test.go:97
        	Error:      	Not equal: 
        	            	expected: []string{"inner/foo.md"}
        	            	actual  : []string{}
        	            	
        	            	Diff:
        	            	--- Expected
        	            	+++ Actual
        	            	@@ -1,3 +1,2 @@
        	            	-([]string) (len=1) {
        	            	- (string) (len=12) "inner/foo.md"
        	            	+([]string) {
        	            	 }
        	Test:       	TestMatches_DisabledNested
=== RUN   TestMatches_Nested
--- FAIL: TestMatches_Nested (0.00s)
    require.go:157: 
        	Error Trace:	matcher_test.go:117
        	Error:      	Not equal: 
        	            	expected: []string{"inner/2.lst", "inner/foo.md", "inner/inner2/moss.ini"}
        	            	actual  : []string{"inner\\2.lst", "inner\\inner2\\moss.ini"}
        	            	
        	            	Diff:
        	            	--- Expected
        	            	+++ Actual
        	            	@@ -1,5 +1,4 @@
        	            	-([]string) (len=3) {
        	            	- (string) (len=11) "inner/2.lst",
        	            	- (string) (len=12) "inner/foo.md",
        	            	- (string) (len=21) "inner/inner2/moss.ini"
        	            	+([]string) (len=2) {
        	            	+ (string) (len=11) "inner\\2.lst",
        	            	+ (string) (len=21) "inner\\inner2\\moss.ini"
        	            	 }
        	Test:       	TestMatches_Nested
=== RUN   TestMatches_ByName
--- FAIL: TestMatches_ByName (0.00s)
    require.go:157: 
        	Error Trace:	matcher_test.go:136
        	Error:      	Not equal: 
        	            	expected: []string{"aa/a1/a2/hello.txt", "aa/a1/hello.txt", "aa/hello.txt", "bb/hello.txt", "hello.txt"}
        	            	actual  : []string{"aa\\a1\\a2\\hello.txt", "aa\\a1\\hello.txt", "aa\\hello.txt", "bb\\hello.txt", "hello.txt"}
        	            	
        	            	Diff:
        	            	--- Expected
        	            	+++ Actual
        	            	@@ -1,6 +1,6 @@
        	            	 ([]string) (len=5) {
        	            	- (string) (len=18) "aa/a1/a2/hello.txt",
        	            	- (string) (len=15) "aa/a1/hello.txt",
        	            	- (string) (len=12) "aa/hello.txt",
        	            	- (string) (len=12) "bb/hello.txt",
        	            	+ (string) (len=18) "aa\\a1\\a2\\hello.txt",
        	            	+ (string) (len=15) "aa\\a1\\hello.txt",
        	            	+ (string) (len=12) "aa\\hello.txt",
        	            	+ (string) (len=12) "bb\\hello.txt",
        	            	  (string) (len=9) "hello.txt"
        	Test:       	TestMatches_ByName
=== RUN   TestMatches_Bothname
--- FAIL: TestMatches_Bothname (0.00s)
    require.go:157: 
        	Error Trace:	matcher_test.go:151
        	Error:      	Not equal: 
        	            	expected: []string{"foo/loss.txt", "loss.txt/1.log", "loss.txt/2.log"}
        	            	actual  : []string{"foo\\loss.txt"}
        	            	
        	            	Diff:
        	            	--- Expected
        	            	+++ Actual
        	            	@@ -1,5 +1,3 @@
        	            	-([]string) (len=3) {
        	            	- (string) (len=12) "foo/loss.txt",
        	            	- (string) (len=14) "loss.txt/1.log",
        	            	- (string) (len=14) "loss.txt/2.log"
        	            	+([]string) (len=1) {
        	            	+ (string) (len=12) "foo\\loss.txt"
        	            	 }
        	Test:       	TestMatches_Bothname
=== RUN   TestMatches_LeadingSpace
--- FAIL: TestMatches_LeadingSpace (0.00s)
    require.go:157: 
        	Error Trace:	matcher_test.go:166
        	Error:      	Not equal: 
        	            	expected: []string{"  what.txt", "inner2/  what.txt"}
        	            	actual  : []string{"  what.txt", "inner2\\  what.txt", "inner\\  what.txt"}
        	            	
        	            	Diff:
        	            	--- Expected
        	            	+++ Actual
        	            	@@ -1,4 +1,5 @@
        	            	-([]string) (len=2) {
        	            	+([]string) (len=3) {
        	            	  (string) (len=10) "  what.txt",
        	            	- (string) (len=17) "inner2/  what.txt"
        	            	+ (string) (len=17) "inner2\\  what.txt",
        	            	+ (string) (len=16) "inner\\  what.txt"
        	            	 }
        	Test:       	TestMatches_LeadingSpace
FAIL
FAIL	github.com/zealic/xignore	0.045s
Command exited with code 1

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.