aboutsummaryrefslogtreecommitdiffstats
path: root/repository.go
diff options
context:
space:
mode:
authorMáximo Cuadros <mcuadros@gmail.com>2016-05-19 16:44:59 +0200
committerMáximo Cuadros <mcuadros@gmail.com>2016-05-19 16:44:59 +0200
commit25077df01588b54ec097ce3f99db6672c5a59463 (patch)
tree49f7b64f4164d19260ba848c5faca366b75438d1 /repository.go
parent08f9e7015aad2ca768638b446fb8632f11601899 (diff)
downloadgo-git-25077df01588b54ec097ce3f99db6672c5a59463.tar.gz
documentation
Diffstat (limited to 'repository.go')
-rw-r--r--repository.go25
1 files changed, 14 insertions, 11 deletions
diff --git a/repository.go b/repository.go
index 87810a6..65e0a5d 100644
--- a/repository.go
+++ b/repository.go
@@ -11,13 +11,16 @@ import (
)
var (
- ObjectNotFoundErr = errors.New("object not found")
+ // ErrObjectNotFound object not found
+ ErrObjectNotFound = errors.New("object not found")
)
const (
+ // DefaultRemoteName name of the default Remote, just like git command
DefaultRemoteName = "origin"
)
+// Repository git repository struct
type Repository struct {
Remotes map[string]*Remote
Storage core.ObjectStorage
@@ -104,8 +107,8 @@ func (r *Repository) PullDefault() (err error) {
func (r *Repository) Commit(h core.Hash) (*Commit, error) {
obj, err := r.Storage.Get(h)
if err != nil {
- if err == core.ObjectNotFoundErr {
- return nil, ObjectNotFoundErr
+ if err == core.ErrObjectNotFound {
+ return nil, ErrObjectNotFound
}
return nil, err
}
@@ -123,8 +126,8 @@ func (r *Repository) Commits() *CommitIter {
func (r *Repository) Tree(h core.Hash) (*Tree, error) {
obj, err := r.Storage.Get(h)
if err != nil {
- if err == core.ObjectNotFoundErr {
- return nil, ObjectNotFoundErr
+ if err == core.ErrObjectNotFound {
+ return nil, ErrObjectNotFound
}
return nil, err
}
@@ -137,8 +140,8 @@ func (r *Repository) Tree(h core.Hash) (*Tree, error) {
func (r *Repository) Blob(h core.Hash) (*Blob, error) {
obj, err := r.Storage.Get(h)
if err != nil {
- if err == core.ObjectNotFoundErr {
- return nil, ObjectNotFoundErr
+ if err == core.ErrObjectNotFound {
+ return nil, ErrObjectNotFound
}
return nil, err
}
@@ -151,8 +154,8 @@ func (r *Repository) Blob(h core.Hash) (*Blob, error) {
func (r *Repository) Tag(h core.Hash) (*Tag, error) {
obj, err := r.Storage.Get(h)
if err != nil {
- if err == core.ObjectNotFoundErr {
- return nil, ObjectNotFoundErr
+ if err == core.ErrObjectNotFound {
+ return nil, ErrObjectNotFound
}
return nil, err
}
@@ -171,8 +174,8 @@ func (r *Repository) Tags() *TagIter {
func (r *Repository) Object(h core.Hash) (Object, error) {
obj, err := r.Storage.Get(h)
if err != nil {
- if err == core.ObjectNotFoundErr {
- return nil, ObjectNotFoundErr
+ if err == core.ErrObjectNotFound {
+ return nil, ErrObjectNotFound
}
return nil, err
}