aboutsummaryrefslogtreecommitdiffstats
path: root/repository.go
diff options
context:
space:
mode:
Diffstat (limited to 'repository.go')
-rw-r--r--repository.go36
1 files changed, 20 insertions, 16 deletions
diff --git a/repository.go b/repository.go
index 5511ba6..4a65f46 100644
--- a/repository.go
+++ b/repository.go
@@ -26,7 +26,7 @@ var (
ErrIsBareRepository = errors.New("worktree not available in a bare repository")
)
-// Repository giturl string, auth common.AuthMethod repository struct
+// Repository represents a git repository
type Repository struct {
r map[string]*Remote
s Storer
@@ -119,7 +119,7 @@ func PlainInit(path string, isBare bool) (*Repository, error) {
return Init(s, wt)
}
-// PlainOpen opens a git repository from the given path. It detects is the
+// PlainOpen opens a git repository from the given path. It detects if the
// repository is bare or a normal one. If the path doesn't contain a valid
// repository ErrRepositoryNotExists is returned
func PlainOpen(path string) (*Repository, error) {
@@ -185,7 +185,7 @@ func (r *Repository) Remote(name string) (*Remote, error) {
return newRemote(r.s, c), nil
}
-// Remotes return all the remotes
+// Remotes returns a list with all the remotes
func (r *Repository) Remotes() ([]*Remote, error) {
cfg, err := r.s.Config()
if err != nil {
@@ -511,12 +511,13 @@ func (r *Repository) Push(o *PushOptions) error {
return remote.Push(o)
}
-// Commit return the commit with the given hash
+// Commit return a Commit with the given hash. If not found
+// plumbing.ErrObjectNotFound is returned
func (r *Repository) Commit(h plumbing.Hash) (*object.Commit, error) {
return object.GetCommit(r.s, h)
}
-// Commits decode the objects into commits
+// Commits returns an unsorted CommitIter with all the commits in the repository
func (r *Repository) Commits() (*object.CommitIter, error) {
iter, err := r.s.IterEncodedObjects(plumbing.CommitObject)
if err != nil {
@@ -526,12 +527,13 @@ func (r *Repository) Commits() (*object.CommitIter, error) {
return object.NewCommitIter(r.s, iter), nil
}
-// Tree return the tree with the given hash
+// Tree return a Tree with the given hash. If not found
+// plumbing.ErrObjectNotFound is returned
func (r *Repository) Tree(h plumbing.Hash) (*object.Tree, error) {
return object.GetTree(r.s, h)
}
-// Trees decodes the objects into trees
+// Trees returns an unsorted TreeIter with all the trees in the repository
func (r *Repository) Trees() (*object.TreeIter, error) {
iter, err := r.s.IterEncodedObjects(plumbing.TreeObject)
if err != nil {
@@ -541,12 +543,13 @@ func (r *Repository) Trees() (*object.TreeIter, error) {
return object.NewTreeIter(r.s, iter), nil
}
-// Blob returns the blob with the given hash
+// Blob returns a Blob with the given hash. If not found
+// plumbing.ErrObjectNotFound is returne
func (r *Repository) Blob(h plumbing.Hash) (*object.Blob, error) {
return object.GetBlob(r.s, h)
}
-// Blobs decodes the objects into blobs
+// Blobs returns an unsorted BlobIter with all the blobs in the repository
func (r *Repository) Blobs() (*object.BlobIter, error) {
iter, err := r.s.IterEncodedObjects(plumbing.BlobObject)
if err != nil {
@@ -556,13 +559,14 @@ func (r *Repository) Blobs() (*object.BlobIter, error) {
return object.NewBlobIter(r.s, iter), nil
}
-// Tag returns a tag with the given hash.
+// Tag returns a Tag with the given hash. If not found
+// plumbing.ErrObjectNotFound is returned
func (r *Repository) Tag(h plumbing.Hash) (*object.Tag, error) {
return object.GetTag(r.s, h)
}
-// Tags returns a object.TagIter that can step through all of the annotated tags
-// in the repository.
+// Tags returns a unsorted TagIter that can step through all of the annotated
+// tags in the repository.
func (r *Repository) Tags() (*object.TagIter, error) {
iter, err := r.s.IterEncodedObjects(plumbing.TagObject)
if err != nil {
@@ -572,7 +576,8 @@ func (r *Repository) Tags() (*object.TagIter, error) {
return object.NewTagIter(r.s, iter), nil
}
-// Object returns an object with the given hash.
+// Object returns an Object with the given hash. If not found
+// plumbing.ErrObjectNotFound is returned
func (r *Repository) Object(t plumbing.ObjectType, h plumbing.Hash) (object.Object, error) {
obj, err := r.s.EncodedObject(t, h)
if err != nil {
@@ -586,8 +591,7 @@ func (r *Repository) Object(t plumbing.ObjectType, h plumbing.Hash) (object.Obje
return object.DecodeObject(r.s, obj)
}
-// Objects returns an object.ObjectIter that can step through all of the annotated tags
-// in the repository.
+// Objects returns an unsorted BlobIter with all the objects in the repository
func (r *Repository) Objects() (*object.ObjectIter, error) {
iter, err := r.s.IterEncodedObjects(plumbing.AnyObject)
if err != nil {
@@ -614,7 +618,7 @@ func (r *Repository) Reference(name plumbing.ReferenceName, resolved bool) (
return r.s.Reference(name)
}
-// References returns a ReferenceIter for all references.
+// References returns an unsorted ReferenceIter for all references.
func (r *Repository) References() (storer.ReferenceIter, error) {
return r.s.IterReferences()
}