mirror of
https://github.com/restic/restic.git
synced 2025-12-12 08:12:39 +00:00
internal/restic: Use IDSet.Clone + use maps package
One place where IDSet.Clone is useful was reinventing it, using a conversion to list, a sort, and a conversion back to map. Also, use the stdlib "maps" package to implement as much of IDSet as possible. This requires changing one caller, which assumed that cloning nil would return a non-nil IDSet.
This commit is contained in:
@@ -347,6 +347,9 @@ func (mi *MasterIndex) Rewrite(ctx context.Context, repo restic.Unpacked, exclud
|
||||
|
||||
// copy excludePacks to prevent unintended sideeffects
|
||||
excludePacks = excludePacks.Clone()
|
||||
if excludePacks == nil {
|
||||
excludePacks = restic.NewIDSet()
|
||||
}
|
||||
debug.Log("start rebuilding index of %d indexes, excludePacks: %v", len(indexes), excludePacks)
|
||||
wg, wgCtx := errgroup.WithContext(ctx)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user