Skip to content

Commit d89f154

Browse files
committed
gx update and fix code to use new Cid type
1 parent 18aab30 commit d89f154

File tree

7 files changed

+23
-23
lines changed

7 files changed

+23
-23
lines changed

blob.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import (
1010

1111
type Blob []byte
1212

13-
func (b Blob) Cid() *cid.Cid {
13+
func (b Blob) Cid() cid.Cid {
1414
c, _ := cid.Prefix{
1515
MhType: mh.SHA1,
1616
MhLength: -1,

commit.go

+5-5
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ import (
1414

1515
type Commit struct {
1616
DataSize string `json:"-"`
17-
GitTree *cid.Cid `json:"tree"`
18-
Parents []*cid.Cid `json:"parents"`
17+
GitTree cid.Cid `json:"tree"`
18+
Parents []cid.Cid `json:"parents"`
1919
Message string `json:"message"`
2020
Author *PersonInfo `json:"author"`
2121
Committer *PersonInfo `json:"committer"`
@@ -26,7 +26,7 @@ type Commit struct {
2626
// Other contains all the non-standard headers, such as 'HG:extra'
2727
Other []string `json:"other,omitempty"`
2828

29-
cid *cid.Cid
29+
cid cid.Cid
3030
}
3131

3232
type PersonInfo struct {
@@ -80,7 +80,7 @@ func (pi *PersonInfo) resolve(p []string) (interface{}, []string, error) {
8080
}
8181

8282
type MergeTag struct {
83-
Object *cid.Cid `json:"object"`
83+
Object cid.Cid `json:"object"`
8484
Type string `json:"type"`
8585
Tag string `json:"tag"`
8686
Tagger *PersonInfo `json:"tagger"`
@@ -91,7 +91,7 @@ type GpgSig struct {
9191
Text string
9292
}
9393

94-
func (c *Commit) Cid() *cid.Cid {
94+
func (c *Commit) Cid() cid.Cid {
9595
return c.cid
9696
}
9797

git.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ func ReadTag(rd *bufio.Reader) (*Tag, error) {
248248
return out, nil
249249
}
250250

251-
func hashObject(data []byte) *cid.Cid {
251+
func hashObject(data []byte) cid.Cid {
252252
c, err := cid.Prefix{
253253
MhType: mh.SHA1,
254254
MhLength: -1,
@@ -437,12 +437,12 @@ func ReadTree(rd *bufio.Reader) (*Tree, error) {
437437
return t, nil
438438
}
439439

440-
func cidToSha(c *cid.Cid) []byte {
440+
func cidToSha(c cid.Cid) []byte {
441441
h := c.Hash()
442442
return h[len(h)-20:]
443443
}
444444

445-
func shaToCid(sha []byte) *cid.Cid {
445+
func shaToCid(sha []byte) cid.Cid {
446446
h, _ := mh.Encode(sha, mh.SHA1)
447447
return cid.NewCidV1(cid.GitRaw, h)
448448
}

git_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ func testNode(t *testing.T, nd node.Node) error {
171171

172172
/*s, _ := commit.Size()
173173
assert.Equal(t, len(commit.RawData()), int(s))*/ //TODO: Known breakage
174-
assert(t, commit.GitTree != nil)
174+
assert(t, commit.GitTree.Defined())
175175
assert(t, commit.Links() != nil)
176176
assert(t, commit.Loggable()["type"] == "git_commit")
177177

@@ -228,7 +228,7 @@ func testNode(t *testing.T, nd node.Node) error {
228228
}
229229

230230
assert(t, tag.Type == "commit" || tag.Type == "tree" || tag.Type == "blob" || tag.Type == "tag")
231-
assert(t, tag.Object != nil)
231+
assert(t, tag.Object.Defined())
232232
assert(t, tag.Loggable()["type"] == "git_tag")
233233
assert(t, tag.Tree("", -1) != nil)
234234
obj, rest, err := tag.ResolveLink([]string{"object", "aoeu"})

package.json

+6-6
Original file line numberDiff line numberDiff line change
@@ -9,21 +9,21 @@
99
"gxDependencies": [
1010
{
1111
"author": "whyrusleeping",
12-
"hash": "QmX5CsuHyVZeTLxgRSYkgLSDQKb9UjE8xnhQzCEJWWWFsC",
12+
"hash": "QmdDXJs4axxefSPgK6Y1QhpJWKuDPnGJiqgq4uncb4rFHL",
1313
"name": "go-ipld-format",
14-
"version": "0.5.8"
14+
"version": "0.6.0"
1515
},
1616
{
1717
"author": "whyrusleeping",
18-
"hash": "QmZFbDTY9jfSBms2MchvYM9oYRbAF19K7Pby47yDBfpPrb",
18+
"hash": "QmPSQnBKM9g7BaUcZCvswUJVscQ1ipjmwxN5PXCjkp9EQ7",
1919
"name": "go-cid",
20-
"version": "0.8.0"
20+
"version": "0.9.0"
2121
},
2222
{
2323
"author": "stebalien",
24-
"hash": "QmWAzSEoqZ6xU6pu8yL8e5WaMb7wtbfbhhN4p1DknUPtr3",
24+
"hash": "QmRcHuYzAyswytBuMF78rj3LTChYszomRFXNg4685ZN1WM",
2525
"name": "go-block-format",
26-
"version": "0.1.11"
26+
"version": "0.2.0"
2727
},
2828
{
2929
"author": "multiformats",

tag.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,17 @@ import (
1111
)
1212

1313
type Tag struct {
14-
Object *cid.Cid `json:"object"`
14+
Object cid.Cid `json:"object"`
1515
Type string `json:"type"`
1616
Tag string `json:"tag"`
1717
Tagger *PersonInfo `json:"tagger"`
1818
Message string `json:"message"`
1919
dataSize string
2020

21-
cid *cid.Cid
21+
cid cid.Cid
2222
}
2323

24-
func (t *Tag) Cid() *cid.Cid {
24+
func (t *Tag) Cid() cid.Cid {
2525
return t.cid
2626
}
2727

tree.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,16 @@ type Tree struct {
1515
entries map[string]*TreeEntry
1616
size int
1717
order []string
18-
cid *cid.Cid
18+
cid cid.Cid
1919
}
2020

2121
type TreeEntry struct {
2222
name string
2323
Mode string `json:"mode"`
24-
Hash *cid.Cid `json:"hash"`
24+
Hash cid.Cid `json:"hash"`
2525
}
2626

27-
func (t *Tree) Cid() *cid.Cid {
27+
func (t *Tree) Cid() cid.Cid {
2828
return t.cid
2929
}
3030

0 commit comments

Comments
 (0)