Skip to content

Commit a0b13f3

Browse files
authored
fix: skip traversal of pointers with the same cid (#109)
1 parent bfa9ebb commit a0b13f3

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

diff.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,9 @@ func diffNode(ctx context.Context, pre, cur *Node, depth int) ([]*Change, error)
8080

8181
// both pointers are shards, recurse down the tree.
8282
if prePointer.isShard() && curPointer.isShard() {
83+
if prePointer.Link == curPointer.Link {
84+
continue
85+
}
8386
preChild, err := prePointer.loadChild(ctx, pre.store, pre.bitWidth, pre.hash)
8487
if err != nil {
8588
return nil, err

diff_parallel.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,9 @@ func (s *diffScheduler) work(ctx context.Context, todo *task, results chan *Chan
192192
switch {
193193
// both pointers are shards, recurse down the tree.
194194
case prePointer.isShard() && curPointer.isShard():
195+
if prePointer.Link == curPointer.Link {
196+
return nil
197+
}
195198
preChild, err := prePointer.loadChild(ctx, pre.store, pre.bitWidth, pre.hash)
196199
if err != nil {
197200
return err

0 commit comments

Comments
 (0)