Fixing version scanning issues
This commit is contained in:
parent
b951af38f1
commit
c062312f04
12
database.go
12
database.go
@ -88,9 +88,7 @@ func (this *database) buildVersions(base string) (versionList, error) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var parent *version
|
||||
var vers versionList
|
||||
|
||||
for _, node := range nodes {
|
||||
if !node.IsDir() {
|
||||
continue
|
||||
@ -101,16 +99,22 @@ func (this *database) buildVersions(base string) (versionList, error) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
ver, err := newVersion(path.Join(base, node.Name()), timestamp, this, parent)
|
||||
ver, err := newVersion(path.Join(base, node.Name()), timestamp, this)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
vers = append(vers, ver)
|
||||
parent = ver
|
||||
}
|
||||
|
||||
sort.Sort(vers)
|
||||
|
||||
var parentVer *version
|
||||
for _, ver := range vers {
|
||||
ver.parent = parentVer
|
||||
parentVer = ver
|
||||
}
|
||||
|
||||
return vers, nil
|
||||
}
|
||||
|
||||
|
@ -48,13 +48,13 @@ type version struct {
|
||||
db *database
|
||||
}
|
||||
|
||||
func newVersion(base string, timestamp time.Time, db *database, parent *version) (*version, error) {
|
||||
func newVersion(base string, timestamp time.Time, db *database) (*version, error) {
|
||||
meta, err := newVersionMetadata(filepath.Join(base, "meta.json"))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &version{base, parent, timestamp, meta, nil, db}, nil
|
||||
return &version{base, nil, timestamp, meta, nil, db}, nil
|
||||
}
|
||||
|
||||
func (this *version) scanDir(path string) (versionedNodeMap, error) {
|
||||
|
Loading…
Reference in New Issue
Block a user