|
|
@ -375,27 +375,33 @@ func (b byTypeAndName) Less(i, j int) bool { return b[i].Less(b[j]) }
|
|
375
|
375
|
func (b byTypeAndName) Swap(i, j int) { b[i], b[j] = b[j], b[i] }
|
|
376
|
376
|
|
|
377
|
377
|
func (fc *FancyCommit) Files(recursive bool) ([]*FancyFile, error) {
|
|
378
|
|
tree, err := fc.commit.Tree()
|
|
379
|
|
if err != nil {
|
|
380
|
|
return nil, err
|
|
381
|
|
}
|
|
|
378
|
if recursive || fc.files == nil {
|
|
|
379
|
tree, err := fc.commit.Tree()
|
|
|
380
|
if err != nil {
|
|
|
381
|
return nil, err
|
|
|
382
|
}
|
|
382
|
383
|
|
|
383
|
|
recurse := 1
|
|
384
|
|
if recursive {
|
|
385
|
|
recurse = 0
|
|
386
|
|
}
|
|
387
|
|
files := make([]*FancyFile, 0)
|
|
388
|
|
err = tree.Walk(func(s string, entry *git.TreeEntry) int {
|
|
389
|
|
files = append(files, NewFancyFile(fc.commit.Owner(), entry))
|
|
390
|
|
return recurse
|
|
391
|
|
})
|
|
392
|
|
if err != nil {
|
|
393
|
|
return nil, err
|
|
394
|
|
}
|
|
|
384
|
recurse := 1
|
|
|
385
|
if recursive {
|
|
|
386
|
recurse = 0
|
|
|
387
|
}
|
|
|
388
|
files := make([]*FancyFile, 0)
|
|
|
389
|
err = tree.Walk(func(s string, entry *git.TreeEntry) int {
|
|
|
390
|
files = append(files, NewFancyFile(fc.commit.Owner(), entry))
|
|
|
391
|
return recurse
|
|
|
392
|
})
|
|
|
393
|
if err != nil {
|
|
|
394
|
return nil, err
|
|
|
395
|
}
|
|
395
|
396
|
|
|
396
|
|
sort.Sort(byTypeAndName(files))
|
|
|
397
|
sort.Sort(byTypeAndName(files))
|
|
397
|
398
|
|
|
398
|
|
return files, nil
|
|
|
399
|
if recursive {
|
|
|
400
|
return files, nil
|
|
|
401
|
}
|
|
|
402
|
fc.files = files
|
|
|
403
|
}
|
|
|
404
|
return fc.files, nil
|
|
399
|
405
|
}
|
|
400
|
406
|
|
|
401
|
407
|
var readmeNames = []string{"README.md", "readme.md", "README.rst", "readme.rst", "README.txt", "readme.txt", "README"}
|