import "github.com/str1ngs/go-git"
const (
NOTBARE = iota
BARE
GIT_SUCCESS = 0
)
func GetHeadString(repo *Repo) (string, error)
func LastError() error
Helper functions
type Commit struct {
// contains filtered or unexported fields
}Commit
func (c *Commit) Author() string
func (c *Commit) Email() string
func (c *Commit) Lookup(r *Repo, o *Oid) (err error)
func (c *Commit) Msg() string
type Entry struct {
// contains filtered or unexported fields
}Entry
func (e *Entry) Filename() string
func (e *Entry) Oid() *Oid
type Index struct {
// contains filtered or unexported fields
}Index
func NewIndex(repo *Repo) (*Index, error)
func (v *Index) Add(file string) (err error)
func (v *Index) EntryCount() int
func (v *Index) Free()
func (v *Index) Get(n int) (*IndexEntry, error)
func (v *Index) Read() (err error)
func (v *Index) Write() (err error)
type IndexEntry struct {
// contains filtered or unexported fields
}
func (i *IndexEntry) Flags() int
func (i *IndexEntry) Oid() *Oid
func (i *IndexEntry) Path() string
type Oid struct {
// contains filtered or unexported fields
}Oid
func GetHead(repo *Repo) (*Oid, error)
TODO: do not assume we are working on refs/heads/master
func NewOid() *Oid
func NewOidString(s string) (*Oid, error)
func TreeFromIndex(repo *Repo, index *Index) (*Oid, error)
func (v *Oid) String() string
type Reference struct {
// contains filtered or unexported fields
}Reference
func (v *Reference) GetOid() (*Oid, error)
func (v *Reference) Lookup(r *Repo, name string) (err error)
func (v *Reference) SetTarget(target string) (err error)
func (v *Reference) Type()
type Repo struct {
// contains filtered or unexported fields
}Repo
func (v *Repo) Free()
func (v *Repo) Init(path string, isbare uint8) (err error)
func (v *Repo) Open(path string) (err error)
type RevWalk struct {
// contains filtered or unexported fields
}RevWalk
func NewRevWalk(repo *Repo) (*RevWalk, error)
func (v *RevWalk) Free()
func (v *RevWalk) Next(o *Oid) (err error)
TODO: end of walk produces a LastError figure out how to reset it and return a os.EOF instead possibly return a Oid? Would make for less boiler plate.
func (v *RevWalk) Push(o *Oid)
func (v *RevWalk) Reset()
func (v *RevWalk) Sorting(sm uint)
TODO: implement this
type Signature struct {
// contains filtered or unexported fields
}TODO: its possible we can use godef to generate this struct Signature
func NewSignature(name, email string) *Signature
func (s Signature) Free()
type Test *C.git_repository
type Tree struct {
// contains filtered or unexported fields
}Tree
func TreeFromCommit(repo *Repo, commit *Commit) (*Tree, error)
func TreeLookup(repo *Repo, oid *Oid) (*Tree, error)
func (t *Tree) EntryByIndex(index int) (*Entry, error)
func (t *Tree) EntryByName(filename string) (*Entry, error)
func (t *Tree) EntryCount() int
func (t *Tree) Free()