@@ -22,6 +22,7 @@ func (s *SuiteFile) SetUpSuite(c *C) {
22
22
packfile string
23
23
}{
24
24
{"https://github.com/tyba/git-fixture.git" , "formats/packfile/fixtures/git-fixture.ofs-delta" },
25
+ {"https://github.com/cpcs499/Final_Pres_P" , "formats/packfile/fixtures/Final_Pres_P.ofs-delta" },
25
26
}
26
27
s .repos = make (map [string ]* Repository , 0 )
27
28
for _ , fixRepo := range fixtureRepos {
@@ -131,3 +132,31 @@ func (s *SuiteFile) TestLines(c *C) {
131
132
"subtest %d: commit=%s, path=%s" , i , t .commit , t .path ))
132
133
}
133
134
}
135
+
136
+ var ignoreEmptyDirEntriesTests = []struct {
137
+ repo string // the repo name as in localRepos
138
+ commit string // the commit to search for the file
139
+ }{
140
+ {
141
+ "https://github.com/cpcs499/Final_Pres_P" ,
142
+ "70bade703ce556c2c7391a8065c45c943e8b6bc3" ,
143
+ // the Final dir in this commit is empty
144
+ },
145
+ }
146
+
147
+ // It is difficult to assert that we are ignoring an (empty) dir as even
148
+ // if we don't, no files will be found in it.
149
+ //
150
+ // At least this test has a high chance of panicking if
151
+ // we don't ignore empty dirs.
152
+ func (s * SuiteFile ) TestIgnoreEmptyDirEntries (c * C ) {
153
+ for i , t := range ignoreEmptyDirEntriesTests {
154
+ commit , err := s .repos [t .repo ].Commit (core .NewHash (t .commit ))
155
+ c .Assert (err , IsNil , Commentf ("subtest %d: %v (%s)" , i , err , t .commit ))
156
+
157
+ for file := range commit .Tree ().Files () {
158
+ _ = file .Contents ()
159
+ // this would probably panic if we are not ignoring empty dirs
160
+ }
161
+ }
162
+ }
0 commit comments