From a0d484113a08a474bf05f87a17c7af54f852d007 Mon Sep 17 00:00:00 2001 From: Alexander Neumann Date: Sun, 24 Jan 2016 21:32:45 +0100 Subject: [PATCH] backends: Do not sort strings Closes #305 --- backend/local/local.go | 4 ---- backend/mem/mem_backend.go | 3 --- backend/sftp/sftp.go | 7 ------- 3 files changed, 14 deletions(-) diff --git a/backend/local/local.go b/backend/local/local.go index b98f118de..49dcb4ccd 100644 --- a/backend/local/local.go +++ b/backend/local/local.go @@ -7,7 +7,6 @@ import ( "io/ioutil" "os" "path/filepath" - "sort" "sync" "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 // stops. 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 if t == backend.Data { 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]) } - sort.Strings(matches) - go func() { defer close(ch) for _, m := range matches { diff --git a/backend/mem/mem_backend.go b/backend/mem/mem_backend.go index 4de0afe82..4e8d3b46c 100644 --- a/backend/mem/mem_backend.go +++ b/backend/mem/mem_backend.go @@ -4,7 +4,6 @@ import ( "bytes" "errors" "io" - "sort" "sync" "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) } - sort.Strings(ids) - debug.Log("MemoryBackend.List", "list %v: %v", t, ids) go func() { diff --git a/backend/sftp/sftp.go b/backend/sftp/sftp.go index 94cc91132..8afc7b7b0 100644 --- a/backend/sftp/sftp.go +++ b/backend/sftp/sftp.go @@ -9,7 +9,6 @@ import ( "os" "os/exec" "path/filepath" - "sort" "strings" "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()) } - sort.Strings(dirs) - // read files for _, dir := range dirs { 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()) } - sort.Strings(items) - for _, file := range items { select { case ch <- file: @@ -442,8 +437,6 @@ func (r *SFTP) List(t backend.Type, done <-chan struct{}) <-chan string { items = append(items, entry.Name()) } - sort.Strings(items) - for _, file := range items { select { case ch <- file: