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

archiver: Read files/dirs in order

This commit is contained in:
Alexander Neumann 2018-05-12 23:07:16 +02:00
parent 256104111d
commit 526956af35

View File

@ -480,7 +480,16 @@ func (arch *Archiver) SaveTree(ctx context.Context, snPath string, atree *Tree,
futureNodes := make(map[string]FutureNode)
for name, subatree := range atree.Nodes {
// iterate over the nodes of atree in lexicographic (=deterministic) order
names := make([]string, 0, len(atree.Nodes))
for name := range atree.Nodes {
names = append(names, name)
}
sort.Stable(sort.StringSlice(names))
for _, name := range names {
subatree := atree.Nodes[name]
// test if context has been cancelled
if ctx.Err() != nil {
return nil, ctx.Err()