mirror of
https://github.com/gitleaks/gitleaks.git
synced 2026-12-01 21:44:23 +01:00
deps
This commit is contained in:
1 parent
4137d3cfc0
commit
744ff2f876
382 files changed
+94483
No files matched your search
+26
@@ -0,0 +1,26 @@
|
||||
package object
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
|
||||
"gopkg.in/src-d/go-git.v4/utils/merkletrie"
|
||||
"gopkg.in/src-d/go-git.v4/utils/merkletrie/noder"
|
||||
)
|
||||
|
||||
// DiffTree compares the content and mode of the blobs found via two
|
||||
// tree objects.
|
||||
func DiffTree(a, b *Tree) (Changes, error) {
|
||||
from := NewTreeRootNode(a)
|
||||
to := NewTreeRootNode(b)
|
||||
|
||||
hashEqual := func(a, b noder.Hasher) bool {
|
||||
return bytes.Equal(a.Hash(), b.Hash())
|
||||
}
|
||||
|
||||
merkletrieChanges, err := merkletrie.DiffTree(from, to, hashEqual)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return newChanges(merkletrieChanges)
|
||||
}
|
||||
Reference in new issue
Block a user