git

package module
v2.0.0+incompatible Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 23, 2015 License: MIT Imports: 13 Imported by: 0

README

go-git GoDoc Build Status codecov.io

Documentation

Index

Constants

View Source
const (
	DefaultRemoteName = "origin"
)

Variables

View Source
var (
	ObjectNotFoundErr = errors.New("object not found")
)

Functions

This section is empty.

Types

type Blob

type Blob struct {
	Hash core.Hash
	Size int64
	// contains filtered or unexported fields
}

Blob is used to store file data - it is generally a file.

func (*Blob) Decode

func (b *Blob) Decode(o core.Object) error

Decode transform an core.Object into a Blob struct

func (*Blob) Reader

func (b *Blob) Reader() io.Reader

Reader returns a reader allow the access to the content of the blob

type Commit

type Commit struct {
	Hash      core.Hash
	Author    Signature
	Committer Signature
	Message   string
	// contains filtered or unexported fields
}

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

func (*Commit) Decode

func (c *Commit) Decode(o core.Object) error

Decode transform an core.Object into a Blob struct

func (*Commit) Parents

func (c *Commit) Parents() *CommitIter

func (*Commit) String

func (c *Commit) String() string

func (*Commit) Tree

func (c *Commit) Tree() *Tree

type CommitIter

type CommitIter struct {
	// contains filtered or unexported fields
}

func NewCommitIter

func NewCommitIter(r *Repository) *CommitIter

func (*CommitIter) Add

func (i *CommitIter) Add(o core.Object)

func (*CommitIter) Close

func (i *CommitIter) Close()

func (*CommitIter) Next

func (i *CommitIter) Next() (*Commit, error)

type File

type File struct {
	Name string
	io.Reader
}

type Hash

type Hash core.Hash

type Remote

type Remote struct {
	Endpoint common.Endpoint
	Auth     common.AuthMethod
	// contains filtered or unexported fields
}

func NewAuthenticatedRemote

func NewAuthenticatedRemote(url string, auth common.AuthMethod) (*Remote, error)

NewAuthenticatedRemote returns a new Remote using the given AuthMethod, using as client http.DefaultClient

func NewRemote

func NewRemote(url string) (*Remote, error)

NewRemote returns a new Remote, using as client http.DefaultClient

func (*Remote) Capabilities

func (r *Remote) Capabilities() *common.Capabilities

Capabilities returns the remote capabilities

func (*Remote) Connect

func (r *Remote) Connect() error

Connect with the endpoint

func (*Remote) DefaultBranch

func (r *Remote) DefaultBranch() string

DefaultBranch returns the name of the remote's default branch

func (*Remote) Fetch

Fetch returns a reader using the request

func (*Remote) FetchDefaultBranch

func (r *Remote) FetchDefaultBranch() (io.ReadCloser, error)

FetchDefaultBranch returns a reader for the default branch

func (*Remote) Info

func (r *Remote) Info() *common.GitUploadPackInfo

Info returns the git-upload-pack info

func (*Remote) Ref

func (r *Remote) Ref(refName string) (core.Hash, error)

Ref returns the Hash pointing the given refName

func (*Remote) Refs

func (r *Remote) Refs() map[string]core.Hash

Refs returns the Hash pointing the given refName

type Repository

type Repository struct {
	Remotes map[string]*Remote
	Storage *core.RAWObjectStorage
}

func NewPlainRepository

func NewPlainRepository() *Repository

NewPlainRepository creates a new repository without remotes

func NewRepository

func NewRepository(url string, auth common.AuthMethod) (*Repository, error)

NewRepository creates a new repository setting remote as default remote

func (*Repository) Commit

func (r *Repository) Commit(h core.Hash) (*Commit, error)

Commit return the commit with the given hash

func (*Repository) Commits

func (r *Repository) Commits() *CommitIter

Commits decode the objects into commits

func (*Repository) Pull

func (r *Repository) Pull(remoteName, branch string) error

func (*Repository) Tree

func (r *Repository) Tree(h core.Hash) (*Tree, error)

Tree return the tree with the given hash

type Signature

type Signature struct {
	Name  string
	Email string
	When  time.Time
}

Signature represents an action signed by a person

func (*Signature) Decode

func (s *Signature) Decode(b []byte)

Decode decodes a byte slice into a signature

func (*Signature) String

func (s *Signature) String() string

type Tree

type Tree struct {
	Entries []TreeEntry
	Hash    core.Hash
	// contains filtered or unexported fields
}

Tree is basically like a directory - it references a bunch of other trees and/or blobs (i.e. files and sub-directories)

func (*Tree) Decode

func (t *Tree) Decode(o core.Object) error

Decode transform an core.Object into a Tree struct

func (*Tree) Files

func (t *Tree) Files() chan *File

type TreeEntry

type TreeEntry struct {
	Name string
	Mode os.FileMode
	Hash core.Hash
}

TreeEntry represents a file

type TreeIter

type TreeIter struct {
	// contains filtered or unexported fields
}

func NewTreeIter

func NewTreeIter(r *Repository) *TreeIter

func (*TreeIter) Add

func (i *TreeIter) Add(o core.Object)

func (*TreeIter) Close

func (i *TreeIter) Close()

func (*TreeIter) Next

func (i *TreeIter) Next() (*Tree, error)

Directories

Path Synopsis
ssh
Package ssh implements a ssh client for go-git.
Package ssh implements a ssh client for go-git.
formats

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL