Files
dolt/walk/diff.go
Chris Masone 5375081821 Address aa comments
1) Change GetReachabilitySetDiff() to Difference()
2) make doTreeWalk() call cb() before it goes ahead and reads a value
2015-07-24 15:51:05 -07:00

22 lines
502 B
Go

package walk
import (
"github.com/attic-labs/noms/chunks"
"github.com/attic-labs/noms/ref"
)
// Difference returns the refs of the chunks reachable from 'big' that cannot be reached from 'small'
func Difference(small, big ref.Ref, cs chunks.ChunkSource) (refs []ref.Ref) {
smallRefs := map[ref.Ref]bool{}
All(small, cs, func(r ref.Ref) {
smallRefs[r] = true
})
Some(big, cs, func(r ref.Ref) (skip bool) {
if skip = smallRefs[r]; !skip {
refs = append(refs, r)
}
return
})
return
}