Skip to content

Commit 0e3ec6b

Browse files
author
jennybuckley
committed
Change how difference works with sets
1 parent 68fbb4f commit 0e3ec6b

File tree

2 files changed

+1
-4
lines changed

2 files changed

+1
-4
lines changed

fieldpath/set.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,6 @@ func (s *Set) Intersection(s2 *Set) *Set {
8080
// Difference returns a Set containing elements which:
8181
// * appear in s
8282
// * do not appear in s2
83-
// * and are not children of elements that appear in s2.
8483
//
8584
// In other words, for leaf fields, this acts like a regular set difference
8685
// operation. When non leaf fields are compared with leaf fields ("parents"
@@ -284,9 +283,6 @@ func (s *SetNodeMap) Difference(s2 *Set) *SetNodeMap {
284283
out := &SetNodeMap{}
285284
for k, sn := range s.members {
286285
pe := sn.pathElement
287-
if s2.Members.Has(pe) {
288-
continue
289-
}
290286
if sn2, ok := s2.Children.members[k]; ok {
291287
diff := *sn.set.Difference(sn2.set)
292288
// We aren't permitted to add nodes with no elements.

fieldpath/set_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,7 @@ func TestSetIntersectionDifference(t *testing.T) {
292292
MakePathOrDie("foo", 0),
293293
MakePathOrDie("b0", nameFirst),
294294
MakePathOrDie("bar", "c0"),
295+
MakePathOrDie("cp", nameFirst, "child"),
295296
)
296297

297298
got := s1.Difference(s2)

0 commit comments

Comments
 (0)