aboutsummaryrefslogtreecommitdiffstats
path: root/utils/merkletrie/index/node.go
diff options
context:
space:
mode:
authorMáximo Cuadros <mcuadros@gmail.com>2017-04-26 20:55:00 +0200
committerMáximo Cuadros <mcuadros@gmail.com>2017-04-26 20:55:00 +0200
commit75c5adffb8b1e80665753784129e2f16210514c1 (patch)
treea51878832cabcd1f2142e4eb855b17f16d7c2ddf /utils/merkletrie/index/node.go
parent9b75cb91384dd08eed2acce8c3099e082835da12 (diff)
downloadgo-git-75c5adffb8b1e80665753784129e2f16210514c1.tar.gz
*: applying new index.Index changes
Diffstat (limited to 'utils/merkletrie/index/node.go')
-rw-r--r--utils/merkletrie/index/node.go6
1 files changed, 5 insertions, 1 deletions
diff --git a/utils/merkletrie/index/node.go b/utils/merkletrie/index/node.go
index 2c72f6d..859c097 100644
--- a/utils/merkletrie/index/node.go
+++ b/utils/merkletrie/index/node.go
@@ -16,7 +16,7 @@ import (
// compared with any other noder.Noder implementation inside of go-git
type node struct {
path string
- entry index.Entry
+ entry *index.Entry
children []noder.Noder
isDir bool
}
@@ -66,6 +66,10 @@ func (n *node) String() string {
// If the node is computed and not based on a index.Entry the hash is equals
// to a 24-bytes slices of zero values.
func (n *node) Hash() []byte {
+ if n.entry == nil {
+ return make([]byte, 24)
+ }
+
return append(n.entry.Hash[:], n.entry.Mode.Bytes()...)
}