MCPcopy
hub / github.com/git-lfs/git-lfs / createFastWalkInputData

Function createFastWalkInputData

tools/filetools_test.go:213–242  ·  view source on GitHub ↗

Make test data - ensure you've Chdir'ed into a temp dir first Returns list of files/dirs that are created First entry is the parent dir of all others

(smallFolder, largeFolder int)

Source from the content-addressed store, hash-verified

211// Returns list of files/dirs that are created
212// First entry is the parent dir of all others
213func createFastWalkInputData(smallFolder, largeFolder int) []string {
214 dirs := []string{
215 "testroot",
216 "testroot/folder1",
217 "testroot/folder2",
218 "testroot/folder2/subfolder1",
219 "testroot/folder2/subfolder2",
220 "testroot/folder2/subfolder3",
221 "testroot/folder2/subfolder4",
222 "testroot/folder2/subfolder4/subsub",
223 }
224 expectedEntries := make([]string, 0, 250)
225
226 for i, dir := range dirs {
227 os.MkdirAll(dir, 0755)
228 numFiles := smallFolder
229 expectedEntries = append(expectedEntries, dir)
230 if i >= 3 && i <= 5 {
231 // Bulk test to ensure works with > 1 batch
232 numFiles = largeFolder
233 }
234 for f := 0; f < numFiles; f++ {
235 filename := join(dir, fmt.Sprintf("file%d.txt", f))
236 os.WriteFile(filename, []byte("TEST"), 0644)
237 expectedEntries = append(expectedEntries, filename)
238 }
239 }
240
241 return expectedEntries
242}
243
244func collectFastWalkResults(fchan <-chan fastWalkInfo) ([]string, []error) {
245 gotEntries := make([]string, 0, 1000)

Callers 1

TestFastWalkBasicFunction · 0.85

Calls 1

joinFunction · 0.70

Tested by

no test coverage detected