mirror of
https://github.com/dolthub/dolt.git
synced 2026-01-31 03:18:43 -06:00
1) Change GetReachabilitySetDiff() to Difference() 2) make doTreeWalk() call cb() before it goes ahead and reads a value
22 lines
502 B
Go
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
|
|
}
|