aboutsummaryrefslogtreecommitdiffstats
path: root/commit.go
diff options
context:
space:
mode:
authorMáximo Cuadros <mcuadros@gmail.com>2015-10-31 01:14:03 +0100
committerMáximo Cuadros <mcuadros@gmail.com>2015-10-31 01:14:03 +0100
commitc6349552c1c54ea114b92ae23fc840f68f6551f4 (patch)
tree6fbaf514ae9caf8241a0b9dfc3709d60942876c5 /commit.go
parentfe1fc1aa7dca3e0f6e54ab17f0acfa45f269e58c (diff)
downloadgo-git-c6349552c1c54ea114b92ae23fc840f68f6551f4.tar.gz
internal -> core
Diffstat (limited to 'commit.go')
-rw-r--r--commit.go26
1 files changed, 14 insertions, 12 deletions
diff --git a/commit.go b/commit.go
index b8a2772..9dce880 100644
--- a/commit.go
+++ b/commit.go
@@ -6,22 +6,24 @@ import (
"fmt"
"io"
- "gopkg.in/src-d/go-git.v2/internal"
+ "gopkg.in/src-d/go-git.v2/core"
)
+type Hash core.Hash
+
// 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
// in time, such as a timestamp, the author of the changes since the last
// commit, a pointer to the previous commit(s), etc.
// http://schacon.github.io/gitbook/1_the_git_object_model.html
type Commit struct {
- Hash internal.Hash
+ Hash core.Hash
Author Signature
Committer Signature
Message string
- tree internal.Hash
- parents []internal.Hash
+ tree core.Hash
+ parents []core.Hash
r *Repository
}
@@ -43,8 +45,8 @@ func (c *Commit) Parents() *CommitIter {
return i
}
-// Decode transform an internal.Object into a Blob struct
-func (c *Commit) Decode(o internal.Object) error {
+// Decode transform an core.Object into a Blob struct
+func (c *Commit) Decode(o core.Object) error {
c.Hash = o.Hash()
r := bufio.NewReader(o.Reader())
@@ -65,9 +67,9 @@ func (c *Commit) Decode(o internal.Object) error {
split := bytes.SplitN(line, []byte{' '}, 2)
switch string(split[0]) {
case "tree":
- c.tree = internal.NewHash(string(split[1]))
+ c.tree = core.NewHash(string(split[1]))
case "parent":
- c.parents = append(c.parents, internal.NewHash(string(split[1])))
+ c.parents = append(c.parents, core.NewHash(string(split[1])))
case "author":
c.Author.Decode(split[1])
case "committer":
@@ -86,7 +88,7 @@ func (c *Commit) Decode(o internal.Object) error {
func (c *Commit) String() string {
return fmt.Sprintf(
"%s %s\nAuthor: %s\nDate: %s\n",
- internal.CommitObject, c.Hash, c.Author.String(), c.Author.When,
+ core.CommitObject, c.Hash, c.Author.String(), c.Author.When,
)
}
@@ -109,16 +111,16 @@ func (i *CommitIter) Next() (*Commit, error) {
}
type iter struct {
- ch chan internal.Object
+ ch chan core.Object
r *Repository
}
func newIter(r *Repository) iter {
- ch := make(chan internal.Object, 1)
+ ch := make(chan core.Object, 1)
return iter{ch, r}
}
-func (i *iter) Add(o internal.Object) {
+func (i *iter) Add(o core.Object) {
i.ch <- o
}