Skip to content
Snippets Groups Projects
Commit ac095bb1 authored by Máximo Cuadros's avatar Máximo Cuadros Committed by GitHub
Browse files

new plumbing package (#118)

* plumbing: now core was renamed to core, and formats and clients moved inside
parent e5237013
No related branches found
No related tags found
No related merge requests found
Showing with 135 additions and 214 deletions
...@@ -8,13 +8,13 @@ import ( ...@@ -8,13 +8,13 @@ import (
"strings" "strings"
"unicode/utf8" "unicode/utf8"
"gopkg.in/src-d/go-git.v4/core"
"gopkg.in/src-d/go-git.v4/diff" "gopkg.in/src-d/go-git.v4/diff"
"gopkg.in/src-d/go-git.v4/plumbing"
) )
type Blame struct { type Blame struct {
Path string Path string
Rev core.Hash Rev plumbing.Hash
Lines []*line Lines []*line
} }
...@@ -256,7 +256,7 @@ func prettyPrintAuthor(c *Commit) string { ...@@ -256,7 +256,7 @@ func prettyPrintAuthor(c *Commit) string {
// utility function to calculate the number of runes needed // utility function to calculate the number of runes needed
// to print the longest author name in the blame of a file. // to print the longest author name in the blame of a file.
func (b *blame) maxAuthorLength() int { func (b *blame) maxAuthorLength() int {
memo := make(map[core.Hash]struct{}, len(b.graph)-1) memo := make(map[plumbing.Hash]struct{}, len(b.graph)-1)
fVs := b.graph[len(b.graph)-1] fVs := b.graph[len(b.graph)-1]
m := 0 m := 0
for ln := range fVs { for ln := range fVs {
......
package git package git
import ( import (
"gopkg.in/src-d/go-git.v4/core"
"gopkg.in/src-d/go-git.v4/fixtures" "gopkg.in/src-d/go-git.v4/fixtures"
"gopkg.in/src-d/go-git.v4/plumbing"
. "gopkg.in/check.v1" . "gopkg.in/check.v1"
) )
...@@ -24,7 +24,7 @@ func (s *BlameSuite) mockBlame(t blameTest, c *C) (blame *Blame) { ...@@ -24,7 +24,7 @@ func (s *BlameSuite) mockBlame(t blameTest, c *C) (blame *Blame) {
r, ok := s.Repositories[t.repo] r, ok := s.Repositories[t.repo]
c.Assert(ok, Equals, true) c.Assert(ok, Equals, true)
commit, err := r.Commit(core.NewHash(t.rev)) commit, err := r.Commit(plumbing.NewHash(t.rev))
c.Assert(err, IsNil, Commentf("%v: repo=%s, rev=%s", err, r, t.rev)) c.Assert(err, IsNil, Commentf("%v: repo=%s, rev=%s", err, r, t.rev))
f, err := commit.File(t.path) f, err := commit.File(t.path)
...@@ -36,7 +36,7 @@ func (s *BlameSuite) mockBlame(t blameTest, c *C) (blame *Blame) { ...@@ -36,7 +36,7 @@ func (s *BlameSuite) mockBlame(t blameTest, c *C) (blame *Blame) {
blamedLines := make([]*line, 0, len(t.blames)) blamedLines := make([]*line, 0, len(t.blames))
for i := range t.blames { for i := range t.blames {
commit, err := r.Commit(core.NewHash(t.blames[i])) commit, err := r.Commit(plumbing.NewHash(t.blames[i]))
c.Assert(err, IsNil) c.Assert(err, IsNil)
l := &line{ l := &line{
author: commit.Author.Email, author: commit.Author.Email,
...@@ -47,7 +47,7 @@ func (s *BlameSuite) mockBlame(t blameTest, c *C) (blame *Blame) { ...@@ -47,7 +47,7 @@ func (s *BlameSuite) mockBlame(t blameTest, c *C) (blame *Blame) {
return &Blame{ return &Blame{
Path: t.path, Path: t.path,
Rev: core.NewHash(t.rev), Rev: plumbing.NewHash(t.rev),
Lines: blamedLines, Lines: blamedLines,
} }
} }
...@@ -65,7 +65,7 @@ func (s *BlameSuite) TestBlame(c *C) { ...@@ -65,7 +65,7 @@ func (s *BlameSuite) TestBlame(c *C) {
r, ok := s.Repositories[t.repo] r, ok := s.Repositories[t.repo]
c.Assert(ok, Equals, true) c.Assert(ok, Equals, true)
commit, err := r.Commit(core.NewHash(t.rev)) commit, err := r.Commit(plumbing.NewHash(t.rev))
c.Assert(err, IsNil) c.Assert(err, IsNil)
obt, err := commit.Blame(t.path) obt, err := commit.Blame(t.path)
......
...@@ -3,35 +3,36 @@ package git ...@@ -3,35 +3,36 @@ package git
import ( import (
"io" "io"
"gopkg.in/src-d/go-git.v4/core" "gopkg.in/src-d/go-git.v4/plumbing"
"gopkg.in/src-d/go-git.v4/plumbing/storer"
) )
// Blob is used to store file data - it is generally a file. // Blob is used to store file data - it is generally a file.
type Blob struct { type Blob struct {
Hash core.Hash Hash plumbing.Hash
Size int64 Size int64
obj core.Object obj plumbing.Object
} }
// ID returns the object ID of the blob. The returned value will always match // ID returns the object ID of the blob. The returned value will always match
// the current value of Blob.Hash. // the current value of Blob.Hash.
// //
// ID is present to fulfill the Object interface. // ID is present to fulfill the Object interface.
func (b *Blob) ID() core.Hash { func (b *Blob) ID() plumbing.Hash {
return b.Hash return b.Hash
} }
// Type returns the type of object. It always returns core.BlobObject. // Type returns the type of object. It always returns plumbing.BlobObject.
// //
// Type is present to fulfill the Object interface. // Type is present to fulfill the Object interface.
func (b *Blob) Type() core.ObjectType { func (b *Blob) Type() plumbing.ObjectType {
return core.BlobObject return plumbing.BlobObject
} }
// Decode transforms a core.Object into a Blob struct. // Decode transforms a plumbing.Object into a Blob struct.
func (b *Blob) Decode(o core.Object) error { func (b *Blob) Decode(o plumbing.Object) error {
if o.Type() != core.BlobObject { if o.Type() != plumbing.BlobObject {
return ErrUnsupportedObject return ErrUnsupportedObject
} }
...@@ -42,8 +43,8 @@ func (b *Blob) Decode(o core.Object) error { ...@@ -42,8 +43,8 @@ func (b *Blob) Decode(o core.Object) error {
return nil return nil
} }
// Encode transforms a Blob into a core.Object. // Encode transforms a Blob into a plumbing.Object.
func (b *Blob) Encode(o core.Object) error { func (b *Blob) Encode(o plumbing.Object) error {
w, err := o.Writer() w, err := o.Writer()
if err != nil { if err != nil {
return err return err
...@@ -55,7 +56,7 @@ func (b *Blob) Encode(o core.Object) error { ...@@ -55,7 +56,7 @@ func (b *Blob) Encode(o core.Object) error {
} }
defer checkClose(r, &err) defer checkClose(r, &err)
_, err = io.Copy(w, r) _, err = io.Copy(w, r)
o.SetType(core.BlobObject) o.SetType(plumbing.BlobObject)
return err return err
} }
...@@ -66,7 +67,7 @@ func (b *Blob) Reader() (io.ReadCloser, error) { ...@@ -66,7 +67,7 @@ func (b *Blob) Reader() (io.ReadCloser, error) {
// BlobIter provides an iterator for a set of blobs. // BlobIter provides an iterator for a set of blobs.
type BlobIter struct { type BlobIter struct {
core.ObjectIter storer.ObjectIter
r *Repository r *Repository
} }
...@@ -74,7 +75,7 @@ type BlobIter struct { ...@@ -74,7 +75,7 @@ type BlobIter struct {
// object iterator. // object iterator.
// //
// The returned BlobIter will automatically skip over non-blob objects. // The returned BlobIter will automatically skip over non-blob objects.
func NewBlobIter(r *Repository, iter core.ObjectIter) *BlobIter { func NewBlobIter(r *Repository, iter storer.ObjectIter) *BlobIter {
return &BlobIter{iter, r} return &BlobIter{iter, r}
} }
...@@ -87,7 +88,7 @@ func (iter *BlobIter) Next() (*Blob, error) { ...@@ -87,7 +88,7 @@ func (iter *BlobIter) Next() (*Blob, error) {
return nil, err return nil, err
} }
if obj.Type() != core.BlobObject { if obj.Type() != plumbing.BlobObject {
continue continue
} }
...@@ -100,8 +101,8 @@ func (iter *BlobIter) Next() (*Blob, error) { ...@@ -100,8 +101,8 @@ func (iter *BlobIter) Next() (*Blob, error) {
// an error happens or the end of the iter is reached. If ErrStop is sent // an error happens or the end of the iter is reached. If ErrStop is sent
// the iteration is stop but no error is returned. The iterator is closed. // the iteration is stop but no error is returned. The iterator is closed.
func (iter *BlobIter) ForEach(cb func(*Blob) error) error { func (iter *BlobIter) ForEach(cb func(*Blob) error) error {
return iter.ObjectIter.ForEach(func(obj core.Object) error { return iter.ObjectIter.ForEach(func(obj plumbing.Object) error {
if obj.Type() != core.BlobObject { if obj.Type() != plumbing.BlobObject {
return nil return nil
} }
......
...@@ -4,7 +4,7 @@ import ( ...@@ -4,7 +4,7 @@ import (
"io" "io"
"io/ioutil" "io/ioutil"
"gopkg.in/src-d/go-git.v4/core" "gopkg.in/src-d/go-git.v4/plumbing"
. "gopkg.in/check.v1" . "gopkg.in/check.v1"
) )
...@@ -16,8 +16,8 @@ type BlobsSuite struct { ...@@ -16,8 +16,8 @@ type BlobsSuite struct {
var _ = Suite(&BlobsSuite{}) var _ = Suite(&BlobsSuite{})
func (s *BlobsSuite) TestBlobHash(c *C) { func (s *BlobsSuite) TestBlobHash(c *C) {
o := &core.MemoryObject{} o := &plumbing.MemoryObject{}
o.SetType(core.BlobObject) o.SetType(plumbing.BlobObject)
o.SetSize(3) o.SetSize(3)
writer, err := o.Writer() writer, err := o.Writer()
...@@ -42,11 +42,11 @@ func (s *BlobsSuite) TestBlobHash(c *C) { ...@@ -42,11 +42,11 @@ func (s *BlobsSuite) TestBlobHash(c *C) {
} }
func (s *BlobsSuite) TestBlobDecodeEncodeIdempotent(c *C) { func (s *BlobsSuite) TestBlobDecodeEncodeIdempotent(c *C) {
var objects []*core.MemoryObject var objects []*plumbing.MemoryObject
for _, str := range []string{"foo", "foo\n"} { for _, str := range []string{"foo", "foo\n"} {
obj := &core.MemoryObject{} obj := &plumbing.MemoryObject{}
obj.Write([]byte(str)) obj.Write([]byte(str))
obj.SetType(core.BlobObject) obj.SetType(plumbing.BlobObject)
obj.Hash() obj.Hash()
objects = append(objects, obj) objects = append(objects, obj)
} }
...@@ -54,7 +54,7 @@ func (s *BlobsSuite) TestBlobDecodeEncodeIdempotent(c *C) { ...@@ -54,7 +54,7 @@ func (s *BlobsSuite) TestBlobDecodeEncodeIdempotent(c *C) {
blob := &Blob{} blob := &Blob{}
err := blob.Decode(object) err := blob.Decode(object)
c.Assert(err, IsNil) c.Assert(err, IsNil)
newObject := &core.MemoryObject{} newObject := &plumbing.MemoryObject{}
err = blob.Encode(newObject) err = blob.Encode(newObject)
c.Assert(err, IsNil) c.Assert(err, IsNil)
newObject.Hash() // Ensure Hash is pre-computed before deep comparison newObject.Hash() // Ensure Hash is pre-computed before deep comparison
......
...@@ -8,11 +8,12 @@ import ( ...@@ -8,11 +8,12 @@ import (
"sort" "sort"
"strings" "strings"
"gopkg.in/src-d/go-git.v4/core" "gopkg.in/src-d/go-git.v4/plumbing"
"gopkg.in/src-d/go-git.v4/plumbing/storer"
) )
// Hash hash of an object // Hash hash of an object
type Hash core.Hash type Hash plumbing.Hash
// Commit points to a single tree, marking it as what the project looked like // Commit points to a single tree, marking it as what the project looked like
// at a certain point in time. It contains meta-information about that point // at a certain point in time. It contains meta-information about that point
...@@ -20,13 +21,13 @@ type Hash core.Hash ...@@ -20,13 +21,13 @@ type Hash core.Hash
// commit, a pointer to the previous commit(s), etc. // commit, a pointer to the previous commit(s), etc.
// http://schacon.github.io/gitbook/1_the_git_object_model.html // http://schacon.github.io/gitbook/1_the_git_object_model.html
type Commit struct { type Commit struct {
Hash core.Hash Hash plumbing.Hash
Author Signature Author Signature
Committer Signature Committer Signature
Message string Message string
tree core.Hash tree plumbing.Hash
parents []core.Hash parents []plumbing.Hash
r *Repository r *Repository
} }
...@@ -38,7 +39,7 @@ func (c *Commit) Tree() (*Tree, error) { ...@@ -38,7 +39,7 @@ func (c *Commit) Tree() (*Tree, error) {
// Parents return a CommitIter to the parent Commits // Parents return a CommitIter to the parent Commits
func (c *Commit) Parents() *CommitIter { func (c *Commit) Parents() *CommitIter {
return NewCommitIter(c.r, return NewCommitIter(c.r,
core.NewObjectLookupIter(c.r.s, core.CommitObject, c.parents), storer.NewObjectLookupIter(c.r.s, plumbing.CommitObject, c.parents),
) )
} }
...@@ -73,20 +74,20 @@ func (c *Commit) Files() (*FileIter, error) { ...@@ -73,20 +74,20 @@ func (c *Commit) Files() (*FileIter, error) {
// the current value of Commit.Hash. // the current value of Commit.Hash.
// //
// ID is present to fulfill the Object interface. // ID is present to fulfill the Object interface.
func (c *Commit) ID() core.Hash { func (c *Commit) ID() plumbing.Hash {
return c.Hash return c.Hash
} }
// Type returns the type of object. It always returns core.CommitObject. // Type returns the type of object. It always returns plumbing.CommitObject.
// //
// Type is present to fulfill the Object interface. // Type is present to fulfill the Object interface.
func (c *Commit) Type() core.ObjectType { func (c *Commit) Type() plumbing.ObjectType {
return core.CommitObject return plumbing.CommitObject
} }
// Decode transforms a core.Object into a Commit struct. // Decode transforms a plumbing.Object into a Commit struct.
func (c *Commit) Decode(o core.Object) (err error) { func (c *Commit) Decode(o plumbing.Object) (err error) {
if o.Type() != core.CommitObject { if o.Type() != plumbing.CommitObject {
return ErrUnsupportedObject return ErrUnsupportedObject
} }
...@@ -117,9 +118,9 @@ func (c *Commit) Decode(o core.Object) (err error) { ...@@ -117,9 +118,9 @@ func (c *Commit) Decode(o core.Object) (err error) {
split := bytes.SplitN(line, []byte{' '}, 2) split := bytes.SplitN(line, []byte{' '}, 2)
switch string(split[0]) { switch string(split[0]) {
case "tree": case "tree":
c.tree = core.NewHash(string(split[1])) c.tree = plumbing.NewHash(string(split[1]))
case "parent": case "parent":
c.parents = append(c.parents, core.NewHash(string(split[1]))) c.parents = append(c.parents, plumbing.NewHash(string(split[1])))
case "author": case "author":
c.Author.Decode(split[1]) c.Author.Decode(split[1])
case "committer": case "committer":
...@@ -147,9 +148,9 @@ func (c *Commit) History() ([]*Commit, error) { ...@@ -147,9 +148,9 @@ func (c *Commit) History() ([]*Commit, error) {
return commits, err return commits, err
} }
// Encode transforms a Commit into a core.Object. // Encode transforms a Commit into a plumbing.Object.
func (b *Commit) Encode(o core.Object) error { func (b *Commit) Encode(o plumbing.Object) error {
o.SetType(core.CommitObject) o.SetType(plumbing.CommitObject)
w, err := o.Writer() w, err := o.Writer()
if err != nil { if err != nil {
return err return err
...@@ -184,7 +185,7 @@ func (b *Commit) Encode(o core.Object) error { ...@@ -184,7 +185,7 @@ func (b *Commit) Encode(o core.Object) error {
func (c *Commit) String() string { func (c *Commit) String() string {
return fmt.Sprintf( return fmt.Sprintf(
"%s %s\nAuthor: %s\nDate: %s\n\n%s\n", "%s %s\nAuthor: %s\nDate: %s\n\n%s\n",
core.CommitObject, c.Hash, c.Author.String(), plumbing.CommitObject, c.Hash, c.Author.String(),
c.Author.When.Format(DateFormat), indent(c.Message), c.Author.When.Format(DateFormat), indent(c.Message),
) )
} }
...@@ -204,7 +205,7 @@ func indent(t string) string { ...@@ -204,7 +205,7 @@ func indent(t string) string {
// CommitIter provides an iterator for a set of commits. // CommitIter provides an iterator for a set of commits.
type CommitIter struct { type CommitIter struct {
core.ObjectIter storer.ObjectIter
r *Repository r *Repository
} }
...@@ -212,7 +213,7 @@ type CommitIter struct { ...@@ -212,7 +213,7 @@ type CommitIter struct {
// object iterator. // object iterator.
// //
// The returned CommitIter will automatically skip over non-commit objects. // The returned CommitIter will automatically skip over non-commit objects.
func NewCommitIter(r *Repository, iter core.ObjectIter) *CommitIter { func NewCommitIter(r *Repository, iter storer.ObjectIter) *CommitIter {
return &CommitIter{iter, r} return &CommitIter{iter, r}
} }
...@@ -232,7 +233,7 @@ func (iter *CommitIter) Next() (*Commit, error) { ...@@ -232,7 +233,7 @@ func (iter *CommitIter) Next() (*Commit, error) {
// an error happends or the end of the iter is reached. If ErrStop is sent // an error happends or the end of the iter is reached. If ErrStop is sent
// the iteration is stop but no error is returned. The iterator is closed. // the iteration is stop but no error is returned. The iterator is closed.
func (iter *CommitIter) ForEach(cb func(*Commit) error) error { func (iter *CommitIter) ForEach(cb func(*Commit) error) error {
return iter.ObjectIter.ForEach(func(obj core.Object) error { return iter.ObjectIter.ForEach(func(obj plumbing.Object) error {
commit := &Commit{r: iter.r} commit := &Commit{r: iter.r}
if err := commit.Decode(obj); err != nil { if err := commit.Decode(obj); err != nil {
return err return err
......
...@@ -4,8 +4,8 @@ import ( ...@@ -4,8 +4,8 @@ import (
"io" "io"
"time" "time"
"gopkg.in/src-d/go-git.v4/core"
"gopkg.in/src-d/go-git.v4/fixtures" "gopkg.in/src-d/go-git.v4/fixtures"
"gopkg.in/src-d/go-git.v4/plumbing"
. "gopkg.in/check.v1" . "gopkg.in/check.v1"
) )
...@@ -20,7 +20,7 @@ var _ = Suite(&SuiteCommit{}) ...@@ -20,7 +20,7 @@ var _ = Suite(&SuiteCommit{})
func (s *SuiteCommit) SetUpSuite(c *C) { func (s *SuiteCommit) SetUpSuite(c *C) {
s.BaseSuite.SetUpSuite(c) s.BaseSuite.SetUpSuite(c)
hash := core.NewHash("1669dce138d9b841a518c64b10914d88f5e488ea") hash := plumbing.NewHash("1669dce138d9b841a518c64b10914d88f5e488ea")
var err error var err error
s.Commit, err = s.Repository.Commit(hash) s.Commit, err = s.Repository.Commit(hash)
...@@ -28,8 +28,8 @@ func (s *SuiteCommit) SetUpSuite(c *C) { ...@@ -28,8 +28,8 @@ func (s *SuiteCommit) SetUpSuite(c *C) {
} }
func (s *SuiteCommit) TestDecodeNonCommit(c *C) { func (s *SuiteCommit) TestDecodeNonCommit(c *C) {
hash := core.NewHash("9a48f23120e880dfbe41f7c9b7b708e9ee62a492") hash := plumbing.NewHash("9a48f23120e880dfbe41f7c9b7b708e9ee62a492")
blob, err := s.Repository.s.Object(core.AnyObject, hash) blob, err := s.Repository.s.Object(plumbing.AnyObject, hash)
c.Assert(err, IsNil) c.Assert(err, IsNil)
commit := &Commit{} commit := &Commit{}
...@@ -38,7 +38,7 @@ func (s *SuiteCommit) TestDecodeNonCommit(c *C) { ...@@ -38,7 +38,7 @@ func (s *SuiteCommit) TestDecodeNonCommit(c *C) {
} }
func (s *SuiteCommit) TestType(c *C) { func (s *SuiteCommit) TestType(c *C) {
c.Assert(s.Commit.Type(), Equals, core.CommitObject) c.Assert(s.Commit.Type(), Equals, plumbing.CommitObject)
} }
func (s *SuiteCommit) TestTree(c *C) { func (s *SuiteCommit) TestTree(c *C) {
...@@ -72,24 +72,24 @@ func (s *SuiteCommit) TestCommitEncodeDecodeIdempotent(c *C) { ...@@ -72,24 +72,24 @@ func (s *SuiteCommit) TestCommitEncodeDecodeIdempotent(c *C) {
Author: Signature{Name: "Foo", Email: "foo@example.local", When: ts}, Author: Signature{Name: "Foo", Email: "foo@example.local", When: ts},
Committer: Signature{Name: "Bar", Email: "bar@example.local", When: ts}, Committer: Signature{Name: "Bar", Email: "bar@example.local", When: ts},
Message: "Message\n\nFoo\nBar\nWith trailing blank lines\n\n", Message: "Message\n\nFoo\nBar\nWith trailing blank lines\n\n",
tree: core.NewHash("f000000000000000000000000000000000000001"), tree: plumbing.NewHash("f000000000000000000000000000000000000001"),
parents: []core.Hash{core.NewHash("f000000000000000000000000000000000000002")}, parents: []plumbing.Hash{plumbing.NewHash("f000000000000000000000000000000000000002")},
}, },
{ {
Author: Signature{Name: "Foo", Email: "foo@example.local", When: ts}, Author: Signature{Name: "Foo", Email: "foo@example.local", When: ts},
Committer: Signature{Name: "Bar", Email: "bar@example.local", When: ts}, Committer: Signature{Name: "Bar", Email: "bar@example.local", When: ts},
Message: "Message\n\nFoo\nBar\nWith no trailing blank lines", Message: "Message\n\nFoo\nBar\nWith no trailing blank lines",
tree: core.NewHash("0000000000000000000000000000000000000003"), tree: plumbing.NewHash("0000000000000000000000000000000000000003"),
parents: []core.Hash{ parents: []plumbing.Hash{
core.NewHash("f000000000000000000000000000000000000004"), plumbing.NewHash("f000000000000000000000000000000000000004"),
core.NewHash("f000000000000000000000000000000000000005"), plumbing.NewHash("f000000000000000000000000000000000000005"),
core.NewHash("f000000000000000000000000000000000000006"), plumbing.NewHash("f000000000000000000000000000000000000006"),
core.NewHash("f000000000000000000000000000000000000007"), plumbing.NewHash("f000000000000000000000000000000000000007"),
}, },
}, },
} }
for _, commit := range commits { for _, commit := range commits {
obj := &core.MemoryObject{} obj := &plumbing.MemoryObject{}
err = commit.Encode(obj) err = commit.Encode(obj)
c.Assert(err, IsNil) c.Assert(err, IsNil)
newCommit := &Commit{} newCommit := &Commit{}
...@@ -130,7 +130,7 @@ func (s *SuiteCommit) TestString(c *C) { ...@@ -130,7 +130,7 @@ func (s *SuiteCommit) TestString(c *C) {
} }
func (s *SuiteCommit) TestStringMultiLine(c *C) { func (s *SuiteCommit) TestStringMultiLine(c *C) {
hash := core.NewHash("e7d896db87294e33ca3202e536d4d9bb16023db3") hash := plumbing.NewHash("e7d896db87294e33ca3202e536d4d9bb16023db3")
s.buildRepositories(c, fixtures.ByURL("https://github.com/src-d/go-git.git")) s.buildRepositories(c, fixtures.ByURL("https://github.com/src-d/go-git.git"))
......
...@@ -3,11 +3,11 @@ package git ...@@ -3,11 +3,11 @@ package git
import ( import (
"io" "io"
"gopkg.in/src-d/go-git.v4/core" "gopkg.in/src-d/go-git.v4/plumbing"
) )
type commitWalker struct { type commitWalker struct {
seen map[core.Hash]bool seen map[plumbing.Hash]bool
stack []*CommitIter stack []*CommitIter
start *Commit start *Commit
cb func(*Commit) error cb func(*Commit) error
...@@ -16,7 +16,7 @@ type commitWalker struct { ...@@ -16,7 +16,7 @@ type commitWalker struct {
// WalkCommitHistory walks the commit history // WalkCommitHistory walks the commit history
func WalkCommitHistory(c *Commit, cb func(*Commit) error) error { func WalkCommitHistory(c *Commit, cb func(*Commit) error) error {
w := &commitWalker{ w := &commitWalker{
seen: make(map[core.Hash]bool), seen: make(map[plumbing.Hash]bool),
stack: make([]*CommitIter, 0), stack: make([]*CommitIter, 0),
start: c, start: c,
cb: cb, cb: cb,
......
...@@ -5,7 +5,7 @@ import ( ...@@ -5,7 +5,7 @@ import (
"strings" "strings"
"gopkg.in/src-d/go-git.v4/config" "gopkg.in/src-d/go-git.v4/config"
"gopkg.in/src-d/go-git.v4/core" "gopkg.in/src-d/go-git.v4/plumbing/storer"
) )
// Storer is a generic storage of objects, references and any information // Storer is a generic storage of objects, references and any information
...@@ -13,8 +13,8 @@ import ( ...@@ -13,8 +13,8 @@ import (
// information in an system directory (such as `.git`) and others // information in an system directory (such as `.git`) and others
// implementations are in memmory being ephemeral // implementations are in memmory being ephemeral
type Storer interface { type Storer interface {
core.ObjectStorer storer.ObjectStorer
core.ReferenceStorer storer.ReferenceStorer
config.ConfigStorer config.ConfigStorer
} }
......
...@@ -6,12 +6,12 @@ import ( ...@@ -6,12 +6,12 @@ import (
"os" "os"
"testing" "testing"
"gopkg.in/src-d/go-git.v4/clients"
"gopkg.in/src-d/go-git.v4/clients/common"
"gopkg.in/src-d/go-git.v4/core"
"gopkg.in/src-d/go-git.v4/fixtures" "gopkg.in/src-d/go-git.v4/fixtures"
"gopkg.in/src-d/go-git.v4/formats/packfile" "gopkg.in/src-d/go-git.v4/plumbing"
"gopkg.in/src-d/go-git.v4/formats/packp" "gopkg.in/src-d/go-git.v4/plumbing/client"
"gopkg.in/src-d/go-git.v4/plumbing/client/common"
"gopkg.in/src-d/go-git.v4/plumbing/format/packfile"
"gopkg.in/src-d/go-git.v4/plumbing/format/packp"
"gopkg.in/src-d/go-git.v4/storage/filesystem" "gopkg.in/src-d/go-git.v4/storage/filesystem"
. "gopkg.in/check.v1" . "gopkg.in/check.v1"
...@@ -94,17 +94,17 @@ func (p *MockGitUploadPackService) Info() (*common.GitUploadPackInfo, error) { ...@@ -94,17 +94,17 @@ func (p *MockGitUploadPackService) Info() (*common.GitUploadPackInfo, error) {
c := packp.NewCapabilities() c := packp.NewCapabilities()
c.Decode("6ecf0ef2c2dffb796033e5a02219af86ec6584e5 HEADmulti_ack thin-pack side-band side-band-64k ofs-delta shallow no-progress include-tag multi_ack_detailed no-done symref=HEAD:refs/heads/master agent=git/2:2.4.8~dbussink-fix-enterprise-tokens-compilation-1167-gc7006cf") c.Decode("6ecf0ef2c2dffb796033e5a02219af86ec6584e5 HEADmulti_ack thin-pack side-band side-band-64k ofs-delta shallow no-progress include-tag multi_ack_detailed no-done symref=HEAD:refs/heads/master agent=git/2:2.4.8~dbussink-fix-enterprise-tokens-compilation-1167-gc7006cf")
ref := core.ReferenceName("refs/heads/master") ref := plumbing.ReferenceName("refs/heads/master")
branch := core.ReferenceName("refs/heads/branch") branch := plumbing.ReferenceName("refs/heads/branch")
tag := core.ReferenceName("refs/tags/v1.0.0") tag := plumbing.ReferenceName("refs/tags/v1.0.0")
return &common.GitUploadPackInfo{ return &common.GitUploadPackInfo{
Capabilities: c, Capabilities: c,
Refs: map[core.ReferenceName]*core.Reference{ Refs: map[plumbing.ReferenceName]*plumbing.Reference{
core.HEAD: core.NewSymbolicReference(core.HEAD, ref), plumbing.HEAD: plumbing.NewSymbolicReference(plumbing.HEAD, ref),
ref: core.NewHashReference(ref, h), ref: plumbing.NewHashReference(ref, h),
tag: core.NewHashReference(tag, h), tag: plumbing.NewHashReference(tag, h),
branch: core.NewHashReference(branch, core.NewHash("e8d3ffab552895c19b9fcf7aa264d277cde33881")), branch: plumbing.NewHashReference(branch, plumbing.NewHash("e8d3ffab552895c19b9fcf7aa264d277cde33881")),
}, },
}, nil }, nil
} }
......
...@@ -3,7 +3,7 @@ package config ...@@ -3,7 +3,7 @@ package config
import ( import (
"strings" "strings"
"gopkg.in/src-d/go-git.v4/core" "gopkg.in/src-d/go-git.v4/plumbing"
) )
const ( const (
...@@ -57,8 +57,8 @@ func (s RefSpec) Src() string { ...@@ -57,8 +57,8 @@ func (s RefSpec) Src() string {
return spec[start:end] return spec[start:end]
} }
// Match match the given core.ReferenceName against the source // Match match the given plumbing.ReferenceName against the source
func (s RefSpec) Match(n core.ReferenceName) bool { func (s RefSpec) Match(n plumbing.ReferenceName) bool {
if !s.IsWildcard() { if !s.IsWildcard() {
return s.matchExact(n) return s.matchExact(n)
} }
...@@ -71,11 +71,11 @@ func (s RefSpec) IsWildcard() bool { ...@@ -71,11 +71,11 @@ func (s RefSpec) IsWildcard() bool {
return strings.Index(string(s), refSpecWildcard) != -1 return strings.Index(string(s), refSpecWildcard) != -1
} }
func (s RefSpec) matchExact(n core.ReferenceName) bool { func (s RefSpec) matchExact(n plumbing.ReferenceName) bool {
return s.Src() == n.String() return s.Src() == n.String()
} }
func (s RefSpec) matchGlob(n core.ReferenceName) bool { func (s RefSpec) matchGlob(n plumbing.ReferenceName) bool {
src := s.Src() src := s.Src()
name := n.String() name := n.String()
wildcard := strings.Index(src, refSpecWildcard) wildcard := strings.Index(src, refSpecWildcard)
...@@ -92,14 +92,14 @@ func (s RefSpec) matchGlob(n core.ReferenceName) bool { ...@@ -92,14 +92,14 @@ func (s RefSpec) matchGlob(n core.ReferenceName) bool {
} }
// Dst returns the destination for the given remote reference // Dst returns the destination for the given remote reference
func (s RefSpec) Dst(n core.ReferenceName) core.ReferenceName { func (s RefSpec) Dst(n plumbing.ReferenceName) plumbing.ReferenceName {
spec := string(s) spec := string(s)
start := strings.Index(spec, refSpecSeparator) + 1 start := strings.Index(spec, refSpecSeparator) + 1
dst := spec[start:] dst := spec[start:]
src := s.Src() src := s.Src()
if !s.IsWildcard() { if !s.IsWildcard() {
return core.ReferenceName(dst) return plumbing.ReferenceName(dst)
} }
name := n.String() name := n.String()
...@@ -107,7 +107,7 @@ func (s RefSpec) Dst(n core.ReferenceName) core.ReferenceName { ...@@ -107,7 +107,7 @@ func (s RefSpec) Dst(n core.ReferenceName) core.ReferenceName {
wd := strings.Index(dst, refSpecWildcard) wd := strings.Index(dst, refSpecWildcard)
match := name[ws : len(name)-(len(src)-(ws+1))] match := name[ws : len(name)-(len(src)-(ws+1))]
return core.ReferenceName(dst[0:wd] + match + dst[wd+1:]) return plumbing.ReferenceName(dst[0:wd] + match + dst[wd+1:])
} }
func (s RefSpec) String() string { func (s RefSpec) String() string {
...@@ -115,7 +115,7 @@ func (s RefSpec) String() string { ...@@ -115,7 +115,7 @@ func (s RefSpec) String() string {
} }
// MatchAny returns true if any of the RefSpec match with the given ReferenceName // MatchAny returns true if any of the RefSpec match with the given ReferenceName
func MatchAny(l []RefSpec, n core.ReferenceName) bool { func MatchAny(l []RefSpec, n plumbing.ReferenceName) bool {
for _, r := range l { for _, r := range l {
if r.Match(n) { if r.Match(n) {
return true return true
......
...@@ -4,7 +4,7 @@ import ( ...@@ -4,7 +4,7 @@ import (
"testing" "testing"
. "gopkg.in/check.v1" . "gopkg.in/check.v1"
"gopkg.in/src-d/go-git.v4/core" "gopkg.in/src-d/go-git.v4/plumbing"
) )
type RefSpecSuite struct{} type RefSpecSuite struct{}
...@@ -42,20 +42,20 @@ func (s *RefSpecSuite) TestRefSpecSrc(c *C) { ...@@ -42,20 +42,20 @@ func (s *RefSpecSuite) TestRefSpecSrc(c *C) {
func (s *RefSpecSuite) TestRefSpecMatch(c *C) { func (s *RefSpecSuite) TestRefSpecMatch(c *C) {
spec := RefSpec("refs/heads/master:refs/remotes/origin/master") spec := RefSpec("refs/heads/master:refs/remotes/origin/master")
c.Assert(spec.Match(core.ReferenceName("refs/heads/foo")), Equals, false) c.Assert(spec.Match(plumbing.ReferenceName("refs/heads/foo")), Equals, false)
c.Assert(spec.Match(core.ReferenceName("refs/heads/master")), Equals, true) c.Assert(spec.Match(plumbing.ReferenceName("refs/heads/master")), Equals, true)
} }
func (s *RefSpecSuite) TestRefSpecMatchBlob(c *C) { func (s *RefSpecSuite) TestRefSpecMatchBlob(c *C) {
spec := RefSpec("refs/heads/*:refs/remotes/origin/*") spec := RefSpec("refs/heads/*:refs/remotes/origin/*")
c.Assert(spec.Match(core.ReferenceName("refs/tag/foo")), Equals, false) c.Assert(spec.Match(plumbing.ReferenceName("refs/tag/foo")), Equals, false)
c.Assert(spec.Match(core.ReferenceName("refs/heads/foo")), Equals, true) c.Assert(spec.Match(plumbing.ReferenceName("refs/heads/foo")), Equals, true)
} }
func (s *RefSpecSuite) TestRefSpecDst(c *C) { func (s *RefSpecSuite) TestRefSpecDst(c *C) {
spec := RefSpec("refs/heads/master:refs/remotes/origin/master") spec := RefSpec("refs/heads/master:refs/remotes/origin/master")
c.Assert( c.Assert(
spec.Dst(core.ReferenceName("refs/heads/master")).String(), Equals, spec.Dst(plumbing.ReferenceName("refs/heads/master")).String(), Equals,
"refs/remotes/origin/master", "refs/remotes/origin/master",
) )
} }
...@@ -63,7 +63,7 @@ func (s *RefSpecSuite) TestRefSpecDst(c *C) { ...@@ -63,7 +63,7 @@ func (s *RefSpecSuite) TestRefSpecDst(c *C) {
func (s *RefSpecSuite) TestRefSpecDstBlob(c *C) { func (s *RefSpecSuite) TestRefSpecDstBlob(c *C) {
spec := RefSpec("refs/heads/*:refs/remotes/origin/*") spec := RefSpec("refs/heads/*:refs/remotes/origin/*")
c.Assert( c.Assert(
spec.Dst(core.ReferenceName("refs/heads/foo")).String(), Equals, spec.Dst(plumbing.ReferenceName("refs/heads/foo")).String(), Equals,
"refs/remotes/origin/foo", "refs/remotes/origin/foo",
) )
} }
...@@ -73,7 +73,7 @@ func (s *RefSpecSuite) TestMatchAny(c *C) { ...@@ -73,7 +73,7 @@ func (s *RefSpecSuite) TestMatchAny(c *C) {
"refs/heads/foo:refs/remotes/origin/bar", "refs/heads/foo:refs/remotes/origin/bar",
} }
c.Assert(MatchAny(specs, core.ReferenceName("refs/heads/foo")), Equals, true) c.Assert(MatchAny(specs, plumbing.ReferenceName("refs/heads/foo")), Equals, true)
c.Assert(MatchAny(specs, core.ReferenceName("refs/heads/bar")), Equals, true) c.Assert(MatchAny(specs, plumbing.ReferenceName("refs/heads/bar")), Equals, true)
c.Assert(MatchAny(specs, core.ReferenceName("refs/heads/master")), Equals, false) c.Assert(MatchAny(specs, plumbing.ReferenceName("refs/heads/master")), Equals, false)
} }
package core
import (
"errors"
"io"
)
var (
//ErrStop is used to stop a ForEach function in an Iter
ErrStop = errors.New("stop iter")
)
// ObjectStorer generic storage of objects
type ObjectStorer interface {
// NewObject returns a new Object, the real type of the object can be a
// custom implementation or the defaul one, MemoryObject
NewObject() Object
// SetObject save an object into the storage, the object shuld be create
// with the NewObject, method, and file if the type is not supported.
SetObject(Object) (Hash, error)
// Object an object by hash with the given ObjectType. Implementors
// should return (nil, ErrObjectNotFound) if an object doesn't exist with
// both the given hash and object type.
//
// Valid ObjectType values are CommitObject, BlobObject, TagObject,
// TreeObject and AnyObject. If AnyObject is given, the object must be
// looked up regardless of its type.
Object(ObjectType, Hash) (Object, error)
// IterObjects returns a custom ObjectIter over all the object on the
// storage.
//
// Valid ObjectType values are CommitObject, BlobObject, TagObject,
IterObjects(ObjectType) (ObjectIter, error)
}
// Transactioner is a optional method for ObjectStorer, it enable transaction
// base write and read operations in the storage
type Transactioner interface {
// Begin starts a transaction.
Begin() Transaction
}
// PackfileWriter is a optional method for ObjectStorer, it enable direct write
// of packfile to the storage
type PackfileWriter interface {
// PackfileWriter retuns a writer for writing a packfile to the Storage,
// this method is optional, if not implemented the ObjectStorer should
// return a ErrNotImplemented error.
//
// If the implementation not implements Writer the objects should be written
// using the Set method.
PackfileWriter() (io.WriteCloser, error)
}
// ObjectIter is a generic closable interface for iterating over objects.
type ObjectIter interface {
Next() (Object, error)
ForEach(func(Object) error) error
Close()
}
// Transaction is an in-progress storage transaction. A transaction must end
// with a call to Commit or Rollback.
type Transaction interface {
SetObject(Object) (Hash, error)
Object(ObjectType, Hash) (Object, error)
Commit() error
Rollback() error
}
// ReferenceStorer generic storage of references
type ReferenceStorer interface {
SetReference(*Reference) error
Reference(ReferenceName) (*Reference, error)
IterReferences() (ReferenceIter, error)
}
// ReferenceIter is a generic closable interface for iterating over references
type ReferenceIter interface {
Next() (*Reference, error)
ForEach(func(*Reference) error) error
Close()
}
...@@ -6,8 +6,8 @@ import ( ...@@ -6,8 +6,8 @@ import (
"strings" "strings"
"golang.org/x/crypto/ssh" "golang.org/x/crypto/ssh"
"gopkg.in/src-d/go-git.v4/clients/http" "gopkg.in/src-d/go-git.v4/plumbing/client/http"
gssh "gopkg.in/src-d/go-git.v4/clients/ssh" gssh "gopkg.in/src-d/go-git.v4/plumbing/client/ssh"
) )
//export c_NewBasicAuth //export c_NewBasicAuth
......
...@@ -8,8 +8,9 @@ import ( ...@@ -8,8 +8,9 @@ import (
"unsafe" "unsafe"
"gopkg.in/src-d/go-git.v4" "gopkg.in/src-d/go-git.v4"
"gopkg.in/src-d/go-git.v4/core" "gopkg.in/src-d/go-git.v4/plumbing"
) )
import "gopkg.in/src-d/go-git.v4/plumbing/storer"
//export c_Commit_get_Hash //export c_Commit_get_Hash
func c_Commit_get_Hash(c uint64) *C.char { func c_Commit_get_Hash(c uint64) *C.char {
...@@ -130,7 +131,7 @@ func c_Commit_Decode(o uint64) (uint64, int, *C.char) { ...@@ -130,7 +131,7 @@ func c_Commit_Decode(o uint64) (uint64, int, *C.char) {
if !ok { if !ok {
return IH, ErrorCodeNotFound, C.CString(MessageNotFound) return IH, ErrorCodeNotFound, C.CString(MessageNotFound)
} }
cobj := obj.(*core.Object) cobj := obj.(*plumbing.Object)
err := commit.Decode(*cobj) err := commit.Decode(*cobj)
if err != nil { if err != nil {
return IH, ErrorCodeInternal, C.CString(err.Error()) return IH, ErrorCodeInternal, C.CString(err.Error())
...@@ -196,7 +197,7 @@ func c_NewCommitIter(r uint64, iter uint64) uint64 { ...@@ -196,7 +197,7 @@ func c_NewCommitIter(r uint64, iter uint64) uint64 {
if !ok { if !ok {
return IH return IH
} }
obj_iter := obj.(*core.ObjectIter) obj_iter := obj.(*storer.ObjectIter)
commit_iter := git.NewCommitIter(repo, *obj_iter) commit_iter := git.NewCommitIter(repo, *obj_iter)
handle := RegisterObject(commit_iter) handle := RegisterObject(commit_iter)
return uint64(handle) return uint64(handle)
......
...@@ -6,7 +6,7 @@ import ( ...@@ -6,7 +6,7 @@ import (
"io/ioutil" "io/ioutil"
"gopkg.in/src-d/go-git.v4" "gopkg.in/src-d/go-git.v4"
"gopkg.in/src-d/go-git.v4/core" "gopkg.in/src-d/go-git.v4/plumbing"
) )
//export c_File_get_Name //export c_File_get_Name
...@@ -55,7 +55,7 @@ func c_File_Decode(o uint64) uint64 { ...@@ -55,7 +55,7 @@ func c_File_Decode(o uint64) uint64 {
if !ok { if !ok {
return IH return IH
} }
cobj := obj.(*core.Object) cobj := obj.(*plumbing.Object)
file := git.File{} file := git.File{}
file.Decode(*cobj) file.Decode(*cobj)
return uint64(RegisterObject(&file)) return uint64(RegisterObject(&file))
......
...@@ -7,7 +7,7 @@ import ( ...@@ -7,7 +7,7 @@ import (
"time" "time"
"gopkg.in/src-d/go-git.v4" "gopkg.in/src-d/go-git.v4"
"gopkg.in/src-d/go-git.v4/core" "gopkg.in/src-d/go-git.v4/plumbing"
) )
//export c_Signature_Name //export c_Signature_Name
...@@ -73,7 +73,7 @@ func c_Blob_Decode(o uint64) uint64 { ...@@ -73,7 +73,7 @@ func c_Blob_Decode(o uint64) uint64 {
if !ok { if !ok {
return IH return IH
} }
cobj := obj.(*core.Object) cobj := obj.(*plumbing.Object)
blob := git.Blob{} blob := git.Blob{}
blob.Decode(*cobj) blob.Decode(*cobj)
return uint64(RegisterObject(&blob)) return uint64(RegisterObject(&blob))
......
...@@ -83,7 +83,7 @@ func c_Repository_set_Storage(r uint64, val uint64) { ...@@ -83,7 +83,7 @@ func c_Repository_set_Storage(r uint64, val uint64) {
if !ok { if !ok {
return return
} }
repo.Storage = *obj.(*core.ObjectStorage) repo.Storage = *obj.(*plumbing.ObjectStorage)
} }
//export c_Repository_Pull //export c_Repository_Pull
...@@ -121,7 +121,7 @@ func c_Repository_Commit(r uint64, h []byte) (uint64, int, *C.char) { ...@@ -121,7 +121,7 @@ func c_Repository_Commit(r uint64, h []byte) (uint64, int, *C.char) {
return IH, ErrorCodeNotFound, C.CString(MessageNotFound) return IH, ErrorCodeNotFound, C.CString(MessageNotFound)
} }
repo := obj.(*git.Repository) repo := obj.(*git.Repository)
var hash core.Hash var hash plumbing.Hash
copy(hash[:], h) copy(hash[:], h)
commit, err := repo.Commit(hash) commit, err := repo.Commit(hash)
if err != nil { if err != nil {
...@@ -153,7 +153,7 @@ func c_Repository_Tree(r uint64, h []byte) (uint64, int, *C.char) { ...@@ -153,7 +153,7 @@ func c_Repository_Tree(r uint64, h []byte) (uint64, int, *C.char) {
return IH, ErrorCodeNotFound, C.CString(MessageNotFound) return IH, ErrorCodeNotFound, C.CString(MessageNotFound)
} }
repo := obj.(*git.Repository) repo := obj.(*git.Repository)
var hash core.Hash var hash plumbing.Hash
copy(hash[:], h) copy(hash[:], h)
tree, err := repo.Tree(hash) tree, err := repo.Tree(hash)
if err != nil { if err != nil {
...@@ -170,7 +170,7 @@ func c_Repository_Blob(r uint64, h []byte) (uint64, int, *C.char) { ...@@ -170,7 +170,7 @@ func c_Repository_Blob(r uint64, h []byte) (uint64, int, *C.char) {
return IH, ErrorCodeNotFound, C.CString(MessageNotFound) return IH, ErrorCodeNotFound, C.CString(MessageNotFound)
} }
repo := obj.(*git.Repository) repo := obj.(*git.Repository)
var hash core.Hash var hash plumbing.Hash
copy(hash[:], h) copy(hash[:], h)
blob, err := repo.Blob(hash) blob, err := repo.Blob(hash)
if err != nil { if err != nil {
...@@ -187,7 +187,7 @@ func c_Repository_Tag(r uint64, h []byte) (uint64, int, *C.char) { ...@@ -187,7 +187,7 @@ func c_Repository_Tag(r uint64, h []byte) (uint64, int, *C.char) {
return IH, ErrorCodeNotFound, C.CString(MessageNotFound) return IH, ErrorCodeNotFound, C.CString(MessageNotFound)
} }
repo := obj.(*git.Repository) repo := obj.(*git.Repository)
var hash core.Hash var hash plumbing.Hash
copy(hash[:], h) copy(hash[:], h)
tag, err := repo.Tag(hash) tag, err := repo.Tag(hash)
if err != nil { if err != nil {
...@@ -219,7 +219,7 @@ func c_Repository_Object(r uint64, h []byte) (uint64, int, *C.char) { ...@@ -219,7 +219,7 @@ func c_Repository_Object(r uint64, h []byte) (uint64, int, *C.char) {
return IH, ErrorCodeNotFound, C.CString(MessageNotFound) return IH, ErrorCodeNotFound, C.CString(MessageNotFound)
} }
repo := obj.(*git.Repository) repo := obj.(*git.Repository)
var hash core.Hash var hash plumbing.Hash
copy(hash[:], h) copy(hash[:], h)
robj, err := repo.Object(hash) robj, err := repo.Object(hash)
if err != nil { if err != nil {
......
...@@ -6,8 +6,9 @@ import ( ...@@ -6,8 +6,9 @@ import (
"io" "io"
"gopkg.in/src-d/go-git.v4" "gopkg.in/src-d/go-git.v4"
"gopkg.in/src-d/go-git.v4/core" "gopkg.in/src-d/go-git.v4/plumbing"
) )
import "gopkg.in/src-d/go-git.v4/plumbing/storer"
func c_Tag_get_Hash(t uint64) *C.char { func c_Tag_get_Hash(t uint64) *C.char {
obj, ok := GetObject(Handle(t)) obj, ok := GetObject(Handle(t))
...@@ -79,7 +80,7 @@ func c_Tag_Decode(o uint64) (uint64, int, *C.char) { ...@@ -79,7 +80,7 @@ func c_Tag_Decode(o uint64) (uint64, int, *C.char) {
if !ok { if !ok {
return IH, ErrorCodeNotFound, C.CString(MessageNotFound) return IH, ErrorCodeNotFound, C.CString(MessageNotFound)
} }
cobj := obj.(*core.Object) cobj := obj.(*plumbing.Object)
tag := git.Tag{} tag := git.Tag{}
err := tag.Decode(*cobj) err := tag.Decode(*cobj)
if err != nil { if err != nil {
...@@ -165,7 +166,7 @@ func c_NewTagIter(r uint64, i uint64) uint64 { ...@@ -165,7 +166,7 @@ func c_NewTagIter(r uint64, i uint64) uint64 {
if !ok { if !ok {
return IH return IH
} }
iter := obj.(*core.ObjectIter) iter := obj.(*storer.ObjectIter)
return uint64(RegisterObject(git.NewTagIter(repo, *iter))) return uint64(RegisterObject(git.NewTagIter(repo, *iter)))
} }
......
...@@ -10,7 +10,7 @@ package main ...@@ -10,7 +10,7 @@ package main
import ( import (
//line /home/mcuadros/workspace/go/src/gopkg.in/src-d/go-git.v4/cshared/tree_cshared.go:7 //line /home/mcuadros/workspace/go/src/gopkg.in/src-d/go-git.v4/cshared/tree_cshared.go:7
"gopkg.in/src-d/go-git.v4" "gopkg.in/src-d/go-git.v4"
"gopkg.in/src-d/go-git.v4/core" "gopkg.in/src-d/go-git.v4/plumbing"
) )
//line /home/mcuadros/workspace/go/src/gopkg.in/src-d/go-git.v4/cshared/tree_cshared.go:13 //line /home/mcuadros/workspace/go/src/gopkg.in/src-d/go-git.v4/cshared/tree_cshared.go:13
...@@ -99,7 +99,7 @@ func c_Tree_Decode(o uint64) (uint64, int, *_Ctype_char) { ...@@ -99,7 +99,7 @@ func c_Tree_Decode(o uint64) (uint64, int, *_Ctype_char) {
if !ok { if !ok {
return IH, ErrorCodeNotFound, _Cfunc_CString(MessageNotFound) return IH, ErrorCodeNotFound, _Cfunc_CString(MessageNotFound)
} }
cobj := obj.(*core.Object) cobj := obj.(*plumbing.Object)
tree := git.Tree{} tree := git.Tree{}
err := tree.Decode(*cobj) err := tree.Decode(*cobj)
if err != nil { if err != nil {
......
...@@ -7,7 +7,7 @@ import ( ...@@ -7,7 +7,7 @@ import (
"gopkg.in/src-d/go-git.v4" "gopkg.in/src-d/go-git.v4"
"gopkg.in/src-d/go-git.v4/config" "gopkg.in/src-d/go-git.v4/config"
"gopkg.in/src-d/go-git.v4/core" "gopkg.in/src-d/go-git.v4/plumbing"
) )
func main() { func main() {
...@@ -46,10 +46,10 @@ func main() { ...@@ -46,10 +46,10 @@ func main() {
color.Blue("git show-ref") color.Blue("git show-ref")
refs, _ := r.Refs() refs, _ := r.Refs()
refs.ForEach(func(ref *core.Reference) error { refs.ForEach(func(ref *plumbing.Reference) error {
// The HEAD is ommitted in a `git show-ref` so we ignore the symbolic // The HEAD is ommitted in a `git show-ref` so we ignore the symbolic
// references, the HEAD // references, the HEAD
if ref.Type() == core.SymbolicReference { if ref.Type() == plumbing.SymbolicReference {
return nil return nil
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment