restic: add IDSet.Clone() method

This commit is contained in:
Michael Eischer 2024-05-19 20:37:19 +02:00
parent 72482ce5bd
commit ad98fbf7dd
2 changed files with 9 additions and 0 deletions

View file

@ -105,3 +105,9 @@ func (s IDSet) String() string {
str := s.List().String()
return "{" + str[1:len(str)-1] + "}"
}
func (s IDSet) Clone() IDSet {
c := NewIDSet()
c.Merge(s)
return c
}

View file

@ -35,4 +35,7 @@ func TestIDSet(t *testing.T) {
}
rtest.Equals(t, "{1285b303 7bb086db f658198b}", set.String())
copied := set.Clone()
rtest.Equals(t, "{1285b303 7bb086db f658198b}", copied.String())
}