GitHub

Original file line numberDiff line numberDiff line change

@@ -33,11 +33,6 @@ func NewKeepLastN(n int, regex string) (*KeepLastN, error) {

3333

}

3434
3535

func (k KeepLastN) KeepRule(snaps []Snapshot) (destroyList []Snapshot) {

36-
37-

if k.n > len(snaps) {

38-

return []Snapshot{}

39-

}

40-
4136

matching, notMatching := partitionSnapList(snaps, func(snapshot Snapshot) bool {

4237

return k.re.MatchString(snapshot.Name())

4338

})

Original file line numberDiff line numberDiff line change

@@ -90,7 +90,7 @@ func TestKeepLastN(t *testing.T) {

9090

stubSnap{"a2", false, o(12)},

9191

},

9292

rules: []KeepRule{

93-

MustKeepLastN(3, "a"),

93+

MustKeepLastN(4, "a"),

9494

},

9595

expDestroy: map[string]bool{

9696

"b1": true,

Read the original on github.com ↗