fixed sorting of synthetic fs.Entries

This commit is contained in:
Jarek Kowalski committed 2017-08-27 14:49:15 -07:00
1 parent ebe00e9405
commit e01fcff9a4
4 files changed
+11

No files matched your search

+7
View File
@@ -55,6 +55,13 @@ func (e Entries) FindByName(n string) Entry {
return nil
}
// Sort sorts the entries by name.
func (e Entries) Sort() {
sort.Slice(e, func(i, j int) bool {
return e[i].Metadata().Name < e[j].Metadata().Name
})
}
// EntryPath returns a path of a given entry from its root node.
func EntryPath(e Entry) string {
var parts []string
+1
View File
@@ -48,6 +48,7 @@ func (s *repositoryAllSources) Readdir() (fs.Entries, error) {
})
}
result.Sort()
return result, nil
}
+2
View File
@@ -44,5 +44,7 @@ func (s *sourceDirectories) Readdir() (fs.Entries, error) {
result = append(result, &sourceSnapshots{s, s.repo, s.snapshotManager, src})
}
result.Sort()
return result, nil
}
+1
View File
@@ -59,6 +59,7 @@ func (s *sourceSnapshots) Readdir() (fs.Entries, error) {
result = append(result, e)
}
result.Sort()
return result, nil
}