Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
dms3
go-merkledag
Commits
0ffc5834
Commit
0ffc5834
authored
Mar 22, 2018
by
Whyrusleeping
Committed by
GitHub
Mar 22, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #4767 from schomatis/fix/dag/diff
dag: diff: check CIDs in base case when comparing nodes
parents
c22b905e
14f3d3ca
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
0 deletions
+5
-0
utils/diff.go
utils/diff.go
+5
-0
No files found.
utils/diff.go
View file @
0ffc5834
...
@@ -95,7 +95,12 @@ func ApplyChange(ctx context.Context, ds ipld.DAGService, nd *dag.ProtoNode, cs
...
@@ -95,7 +95,12 @@ func ApplyChange(ctx context.Context, ds ipld.DAGService, nd *dag.ProtoNode, cs
// Diff returns a set of changes that transform node 'a' into node 'b'
// Diff returns a set of changes that transform node 'a' into node 'b'
func
Diff
(
ctx
context
.
Context
,
ds
ipld
.
DAGService
,
a
,
b
ipld
.
Node
)
([]
*
Change
,
error
)
{
func
Diff
(
ctx
context
.
Context
,
ds
ipld
.
DAGService
,
a
,
b
ipld
.
Node
)
([]
*
Change
,
error
)
{
// Base case where both nodes are leaves, just compare
// their CIDs.
if
len
(
a
.
Links
())
==
0
&&
len
(
b
.
Links
())
==
0
{
if
len
(
a
.
Links
())
==
0
&&
len
(
b
.
Links
())
==
0
{
if
a
.
Cid
()
.
Equals
(
b
.
Cid
())
{
return
[]
*
Change
{},
nil
}
return
[]
*
Change
{
return
[]
*
Change
{
&
Change
{
&
Change
{
Type
:
Mod
,
Type
:
Mod
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment