|
@@ -27,6 +27,7 @@ import (
|
|
|
"gopkg.in/src-d/go-billy.v4/memfs"
|
|
|
"gopkg.in/src-d/go-billy.v4/osfs"
|
|
|
"gopkg.in/src-d/go-git.v4"
|
|
|
+ "gopkg.in/src-d/go-git.v4/plumbing/cache"
|
|
|
"gopkg.in/src-d/go-git.v4/plumbing/object"
|
|
|
"gopkg.in/src-d/go-git.v4/plumbing/transport/ssh"
|
|
|
"gopkg.in/src-d/go-git.v4/storage"
|
|
@@ -69,10 +70,7 @@ func loadRepository(uri string, cachePath string, disableStatus bool, sshIdentit
|
|
|
var err error
|
|
|
if strings.Contains(uri, "://") || regexp.MustCompile("^[A-Za-z]\\w*@[A-Za-z0-9][\\w.]*:").MatchString(uri) {
|
|
|
if cachePath != "" {
|
|
|
- backend, err = filesystem.NewStorage(osfs.New(cachePath))
|
|
|
- if err != nil {
|
|
|
- panic(err)
|
|
|
- }
|
|
|
+ backend = filesystem.NewStorage(osfs.New(cachePath), cache.NewObjectLRUDefault())
|
|
|
_, err = os.Stat(cachePath)
|
|
|
if !os.IsNotExist(err) {
|
|
|
log.Printf("warning: deleted %s\n", cachePath)
|
|
@@ -107,10 +105,7 @@ func loadRepository(uri string, cachePath string, disableStatus bool, sshIdentit
|
|
|
if err2 != nil {
|
|
|
log.Panicf("unable to create a siva filesystem from %s: %v", uri, err2)
|
|
|
}
|
|
|
- sivaStorage, err2 := filesystem.NewStorage(fs)
|
|
|
- if err2 != nil {
|
|
|
- log.Panicf("unable to create a new storage backend for siva file %s: %v", uri, err2)
|
|
|
- }
|
|
|
+ sivaStorage := filesystem.NewStorage(fs, cache.NewObjectLRUDefault())
|
|
|
repository, err = git.Open(sivaStorage, tmpFs)
|
|
|
} else {
|
|
|
if uri[len(uri)-1] == os.PathSeparator {
|