2
2
mirror of https://github.com/octoleo/restic.git synced 2024-12-22 02:48:55 +00:00

Merge pull request #2628 from MichaelEischer/one-element-pack-lists

cache: Don't sort one element pack lists
This commit is contained in:
MichaelEischer 2020-04-18 17:09:06 +02:00 committed by GitHub
commit 16710454f4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -111,6 +111,11 @@ func (r *Repository) sortCachedPacks(blobs []restic.PackedBlob) []restic.PackedB
return blobs
}
// no need to sort a list with one element
if len(blobs) == 1 {
return blobs
}
cached := make([]restic.PackedBlob, 0, len(blobs)/2)
noncached := make([]restic.PackedBlob, 0, len(blobs)/2)