@@ -20,6 +20,7 @@ import (
2020 "github.com/sirupsen/logrus"
2121 "github.com/src-d/go-borges"
2222 "github.com/src-d/go-borges/libraries"
23+ "github.com/src-d/go-borges/oldsiva"
2324 "github.com/src-d/go-borges/plain"
2425 "github.com/src-d/go-borges/siva"
2526 sqle "github.com/src-d/go-mysql-server"
@@ -227,7 +228,7 @@ func (c *Server) buildDatabase() error {
227228
228229 c .sharedCache = cache .NewObjectLRU (c .CacheSize * cache .MiByte )
229230
230- c .rootLibrary = libraries .New (libraries. Options {} )
231+ c .rootLibrary = libraries .New (nil )
231232 c .pool = gitbase .NewRepositoryPool (c .sharedCache , c .rootLibrary )
232233
233234 if err := c .addDirectories (); err != nil {
@@ -318,18 +319,34 @@ func (c *Server) addDirectories() error {
318319
319320func (c * Server ) addDirectory (d directory ) error {
320321 if d .Format == "siva" {
321- sivaOpts := siva.LibraryOptions {
322- Transactional : true ,
323- RootedRepo : d .Rooted ,
324- Cache : c .sharedCache ,
325- Bucket : d .Bucket ,
326- Performance : true ,
327- RegistryCache : 100000 ,
328- }
322+ var lib borges.Library
323+ var err error
324+
325+ if d .Rooted {
326+ sivaOpts := & siva.LibraryOptions {
327+ Transactional : true ,
328+ RootedRepo : d .Rooted ,
329+ Cache : c .sharedCache ,
330+ Bucket : d .Bucket ,
331+ Performance : true ,
332+ RegistryCache : 100000 ,
333+ }
329334
330- lib , err := siva .NewLibrary (d .Path , osfs .New (d .Path ), sivaOpts )
331- if err != nil {
332- return err
335+ lib , err = siva .NewLibrary (d .Path , osfs .New (d .Path ), sivaOpts )
336+ if err != nil {
337+ return err
338+ }
339+ } else {
340+ sivaOpts := & oldsiva.LibraryOptions {
341+ Cache : c .sharedCache ,
342+ Bucket : d .Bucket ,
343+ RegistryCache : 100000 ,
344+ }
345+
346+ lib , err = oldsiva .NewLibrary (d .Path , osfs .New (d .Path ), sivaOpts )
347+ if err != nil {
348+ return err
349+ }
333350 }
334351
335352 err = c .rootLibrary .Add (lib )
0 commit comments