@@ -11,7 +11,6 @@ import (
11
11
12
12
type MatcherSuite struct {
13
13
GFS billy.Filesystem // git repository root
14
- IEFS billy.Filesystem // git repository root using info/exclude instead
15
14
RFS billy.Filesystem // root that contains user home
16
15
MCFS billy.Filesystem // root that contains user home, but missing ~/.gitconfig
17
16
MEFS billy.Filesystem // root that contains user home, but missing excludesfile entry
@@ -25,40 +24,17 @@ var _ = Suite(&MatcherSuite{})
25
24
func (s * MatcherSuite ) SetUpTest (c * C ) {
26
25
// setup generic git repository root
27
26
fs := memfs .New ()
28
- f , err := fs .Create (".gitignore" )
29
- c .Assert (err , IsNil )
30
- _ , err = f .Write ([]byte ("vendor/g*/\n " ))
31
- c .Assert (err , IsNil )
32
- _ , err = f .Write ([]byte ("ignore.crlf\r \n " ))
33
- c .Assert (err , IsNil )
34
- err = f .Close ()
35
- c .Assert (err , IsNil )
36
27
37
- err = fs .MkdirAll ("vendor " , os .ModePerm )
28
+ err : = fs .MkdirAll (".git/info " , os .ModePerm )
38
29
c .Assert (err , IsNil )
39
- f , err = fs .Create ("vendor/.gitignore " )
30
+ f , err : = fs .Create (".git/info/exclude " )
40
31
c .Assert (err , IsNil )
41
- _ , err = f .Write ([]byte ("!github.com/ \n " ))
32
+ _ , err = f .Write ([]byte ("exclude.crlf \r \n " ))
42
33
c .Assert (err , IsNil )
43
34
err = f .Close ()
44
35
c .Assert (err , IsNil )
45
36
46
- err = fs .MkdirAll ("another" , os .ModePerm )
47
- c .Assert (err , IsNil )
48
- err = fs .MkdirAll ("ignore.crlf" , os .ModePerm )
49
- c .Assert (err , IsNil )
50
- err = fs .MkdirAll ("vendor/github.com" , os .ModePerm )
51
- c .Assert (err , IsNil )
52
- err = fs .MkdirAll ("vendor/gopkg.in" , os .ModePerm )
53
- c .Assert (err , IsNil )
54
-
55
- s .GFS = fs
56
-
57
- // setup generic git repository root using info/exclude instead
58
- fs = memfs .New ()
59
- err = fs .MkdirAll (".git/info" , os .ModePerm )
60
- c .Assert (err , IsNil )
61
- f , err = fs .Create (".git/info/exclude" )
37
+ f , err = fs .Create (".gitignore" )
62
38
c .Assert (err , IsNil )
63
39
_ , err = f .Write ([]byte ("vendor/g*/\n " ))
64
40
c .Assert (err , IsNil )
@@ -78,14 +54,16 @@ func (s *MatcherSuite) SetUpTest(c *C) {
78
54
79
55
err = fs .MkdirAll ("another" , os .ModePerm )
80
56
c .Assert (err , IsNil )
57
+ err = fs .MkdirAll ("exclude.crlf" , os .ModePerm )
58
+ c .Assert (err , IsNil )
81
59
err = fs .MkdirAll ("ignore.crlf" , os .ModePerm )
82
60
c .Assert (err , IsNil )
83
61
err = fs .MkdirAll ("vendor/github.com" , os .ModePerm )
84
62
c .Assert (err , IsNil )
85
63
err = fs .MkdirAll ("vendor/gopkg.in" , os .ModePerm )
86
64
c .Assert (err , IsNil )
87
65
88
- s .IEFS = fs
66
+ s .GFS = fs
89
67
90
68
// setup root that contains user home
91
69
home , err := os .UserHomeDir ()
@@ -207,18 +185,10 @@ func (s *MatcherSuite) SetUpTest(c *C) {
207
185
func (s * MatcherSuite ) TestDir_ReadPatterns (c * C ) {
208
186
ps , err := ReadPatterns (s .GFS , nil )
209
187
c .Assert (err , IsNil )
210
- c .Assert (ps , HasLen , 3 )
188
+ c .Assert (ps , HasLen , 4 )
211
189
212
190
m := NewMatcher (ps )
213
- c .Assert (m .Match ([]string {"ignore.crlf" }, true ), Equals , true )
214
- c .Assert (m .Match ([]string {"vendor" , "gopkg.in" }, true ), Equals , true )
215
- c .Assert (m .Match ([]string {"vendor" , "github.com" }, true ), Equals , false )
216
-
217
- ps , err = ReadPatterns (s .IEFS , nil )
218
- c .Assert (err , IsNil )
219
- c .Assert (ps , HasLen , 3 )
220
-
221
- m = NewMatcher (ps )
191
+ c .Assert (m .Match ([]string {"exclude.crlf" }, true ), Equals , true )
222
192
c .Assert (m .Match ([]string {"ignore.crlf" }, true ), Equals , true )
223
193
c .Assert (m .Match ([]string {"vendor" , "gopkg.in" }, true ), Equals , true )
224
194
c .Assert (m .Match ([]string {"vendor" , "github.com" }, true ), Equals , false )
0 commit comments