Skip to content

Commit cbe2a92

Browse files
Merge pull request #48 from ipfs/fix-mutex-copying
don't copy mutexes
2 parents 94da8f4 + abe0b05 commit cbe2a92

File tree

3 files changed

+23
-5
lines changed

3 files changed

+23
-5
lines changed

commit.go

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,19 @@ func (c *Commit) Cid() cid.Cid {
124124
}
125125

126126
func (c *Commit) Copy() node.Node {
127-
nc := *c
128-
return &nc
127+
return &Commit{
128+
DataSize: c.DataSize,
129+
GitTree: c.GitTree,
130+
Parents: c.Parents,
131+
Message: c.Message,
132+
Author: c.Author,
133+
Committer: c.Committer,
134+
Encoding: c.Encoding,
135+
Sig: c.Sig,
136+
MergeTag: c.MergeTag,
137+
Other: c.Other,
138+
cid: c.cid,
139+
}
129140
}
130141

131142
func (c *Commit) Links() []*node.Link {

tag.go

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,15 @@ func (t *Tag) Cid() cid.Cid {
3030
}
3131

3232
func (t *Tag) Copy() node.Node {
33-
nt := *t
34-
return &nt
33+
return &Tag{
34+
Object: t.Object,
35+
Type: t.Type,
36+
Tag: t.Tag,
37+
Tagger: t.Tagger,
38+
Message: t.Message,
39+
dataSize: t.dataSize,
40+
cid: t.cid,
41+
}
3542
}
3643

3744
func (t *Tag) Links() []*node.Link {

tree.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ func (t *Tree) Resolve(p []string) (interface{}, []string, error) {
131131
}
132132
}
133133

134-
func (t Tree) ResolveLink(path []string) (*node.Link, []string, error) {
134+
func (t *Tree) ResolveLink(path []string) (*node.Link, []string, error) {
135135
out, rest, err := t.Resolve(path)
136136
if err != nil {
137137
return nil, nil, err

0 commit comments

Comments
 (0)