backends: Do not sort strings

Closes #305
This commit is contained in:
Alexander Neumann 2016-01-24 21:32:45 +01:00
parent d9c87559b5
commit a0d484113a
3 changed files with 0 additions and 14 deletions

View file

@ -7,7 +7,6 @@ import (
"io/ioutil" "io/ioutil"
"os" "os"
"path/filepath" "path/filepath"
"sort"
"sync" "sync"
"github.com/restic/restic/backend" "github.com/restic/restic/backend"
@ -253,7 +252,6 @@ func (b *Local) Remove(t backend.Type, name string) error {
// goroutine is started for this. If the channel done is closed, sending // goroutine is started for this. If the channel done is closed, sending
// stops. // stops.
func (b *Local) List(t backend.Type, done <-chan struct{}) <-chan string { func (b *Local) List(t backend.Type, done <-chan struct{}) <-chan string {
// TODO: use os.Open() and d.Readdirnames() instead of Glob()
var pattern string var pattern string
if t == backend.Data { if t == backend.Data {
pattern = filepath.Join(dirname(b.p, t, ""), "*", "*") pattern = filepath.Join(dirname(b.p, t, ""), "*", "*")
@ -272,8 +270,6 @@ func (b *Local) List(t backend.Type, done <-chan struct{}) <-chan string {
matches[i] = filepath.Base(matches[i]) matches[i] = filepath.Base(matches[i])
} }
sort.Strings(matches)
go func() { go func() {
defer close(ch) defer close(ch)
for _, m := range matches { for _, m := range matches {

View file

@ -4,7 +4,6 @@ import (
"bytes" "bytes"
"errors" "errors"
"io" "io"
"sort"
"sync" "sync"
"github.com/restic/restic/backend" "github.com/restic/restic/backend"
@ -232,8 +231,6 @@ func memList(be *MemoryBackend, t backend.Type, done <-chan struct{}) <-chan str
ids = append(ids, entry.Name) ids = append(ids, entry.Name)
} }
sort.Strings(ids)
debug.Log("MemoryBackend.List", "list %v: %v", t, ids) debug.Log("MemoryBackend.List", "list %v: %v", t, ids)
go func() { go func() {

View file

@ -9,7 +9,6 @@ import (
"os" "os"
"os/exec" "os/exec"
"path/filepath" "path/filepath"
"sort"
"strings" "strings"
"github.com/juju/errors" "github.com/juju/errors"
@ -407,8 +406,6 @@ func (r *SFTP) List(t backend.Type, done <-chan struct{}) <-chan string {
dirs = append(dirs, d.Name()) dirs = append(dirs, d.Name())
} }
sort.Strings(dirs)
// read files // read files
for _, dir := range dirs { for _, dir := range dirs {
entries, err := r.c.ReadDir(Join(basedir, dir)) entries, err := r.c.ReadDir(Join(basedir, dir))
@ -421,8 +418,6 @@ func (r *SFTP) List(t backend.Type, done <-chan struct{}) <-chan string {
items = append(items, entry.Name()) items = append(items, entry.Name())
} }
sort.Strings(items)
for _, file := range items { for _, file := range items {
select { select {
case ch <- file: case ch <- file:
@ -442,8 +437,6 @@ func (r *SFTP) List(t backend.Type, done <-chan struct{}) <-chan string {
items = append(items, entry.Name()) items = append(items, entry.Name())
} }
sort.Strings(items)
for _, file := range items { for _, file := range items {
select { select {
case ch <- file: case ch <- file: