git

package module
v0.0.0-...-591a67f Latest Latest
Warning

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

Go to latest
Published: May 23, 2014 License: MIT Imports: 12 Imported by: 11 modules, 11 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

git2go

Go bindings for libgit2. These bindings are for top-of-the-branch libgit2, and they move fast, things may or may not work. Operator get me Beijing-jing-jing-jing!

Installing

Just go get github.com/libgit2/git2go. You'll need to have top-of-the-branch libgit2 from development installed in your system and available via pkg-config. These bindings are in sync with the top of development.

License

M to the I to the T. See the LICENSE file if you've never seen a MIT license before.

Authors

  • Carlos Martín (@carlosmn)
  • Vicent Martí (@vmg)

Documentation

Index

Constants

View Source
const (
	CheckoutNone                      CheckoutStrategy = C.GIT_CHECKOUT_NONE                         // Dry run, no actual updates
	CheckoutSafe                                       = C.GIT_CHECKOUT_SAFE                         // Allow safe updates that cannot overwrite uncommitted data
	CheckoutSafeCreate                                 = C.GIT_CHECKOUT_SAFE_CREATE                  // Allow safe updates plus creation of missing files
	CheckoutForce                                      = C.GIT_CHECKOUT_FORCE                        // Allow all updates to force working directory to look like index
	CheckoutAllowConflicts                             = C.GIT_CHECKOUT_ALLOW_CONFLICTS              // Allow checkout to make safe updates even if conflicts are found
	CheckoutRemoveUntracked                            = C.GIT_CHECKOUT_REMOVE_UNTRACKED             // Remove untracked files not in index (that are not ignored)
	CheckoutRemoveIgnored                              = C.GIT_CHECKOUT_REMOVE_IGNORED               // Remove ignored files not in index
	CheckotUpdateOnly                                  = C.GIT_CHECKOUT_UPDATE_ONLY                  // Only update existing files, don't create new ones
	CheckoutDontUpdateIndex                            = C.GIT_CHECKOUT_DONT_UPDATE_INDEX            // Normally checkout updates index entries as it goes; this stops that
	CheckoutNoRefresh                                  = C.GIT_CHECKOUT_NO_REFRESH                   // Don't refresh index/config/etc before doing checkout
	CheckooutDisablePathspecMatch                      = C.GIT_CHECKOUT_DISABLE_PATHSPEC_MATCH       // Treat pathspec as simple list of exact match file paths
	CheckoutSkipUnmerged                               = C.GIT_CHECKOUT_SKIP_UNMERGED                // Allow checkout to skip unmerged files (NOT IMPLEMENTED)
	CheckoutUserOurs                                   = C.GIT_CHECKOUT_USE_OURS                     // For unmerged files, checkout stage 2 from index (NOT IMPLEMENTED)
	CheckoutUseTheirs                                  = C.GIT_CHECKOUT_USE_THEIRS                   // For unmerged files, checkout stage 3 from index (NOT IMPLEMENTED)
	CheckoutUpdateSubmodules                           = C.GIT_CHECKOUT_UPDATE_SUBMODULES            // Recursively checkout submodules with same options (NOT IMPLEMENTED)
	CheckoutUpdateSubmodulesIfChanged                  = C.GIT_CHECKOUT_UPDATE_SUBMODULES_IF_CHANGED // Recursively checkout submodules if HEAD moved in super repo (NOT IMPLEMENTED)
)
View Source
const (
	CredTypeUserpassPlaintext CredType = C.GIT_CREDTYPE_USERPASS_PLAINTEXT
	CredTypeSshKey                     = C.GIT_CREDTYPE_SSH_KEY
	CredTypeSshCustom                  = C.GIT_CREDTYPE_SSH_CUSTOM
	CredTypeDefault                    = C.GIT_CREDTYPE_DEFAULT
)
View Source
const (
	ITEROVER  = C.GIT_ITEROVER
	EEXISTS   = C.GIT_EEXISTS
	ENOTFOUND = C.GIT_ENOTFOUND
)
View Source
const (
	ObjectAny    ObjectType = C.GIT_OBJ_ANY
	ObjectBad               = C.GIT_OBJ_BAD
	ObjectCommit            = C.GIT_OBJ_COMMIT
	ObjectTree              = C.GIT_OBJ_TREE
	ObjectBlob              = C.GIT_OBJ_BLOB
	ObjectTag               = C.GIT_OBJ_TAG
)
View Source
const (
	RemoteCompletionDownload RemoteCompletion = C.GIT_REMOTE_COMPLETION_DOWNLOAD
	RemoteCompletionIndexing                  = C.GIT_REMOTE_COMPLETION_INDEXING
	RemoteCompletionError                     = C.GIT_REMOTE_COMPLETION_ERROR
)
View Source
const (
	SubmoduleUpdateReset    SubmoduleUpdate = C.GIT_SUBMODULE_UPDATE_RESET
	SubmoduleUpdateCheckout                 = C.GIT_SUBMODULE_UPDATE_CHECKOUT
	SubmoduleUpdateRebase                   = C.GIT_SUBMODULE_UPDATE_REBASE
	SubmoduleUpdateMerge                    = C.GIT_SUBMODULE_UPDATE_MERGE
	SubmoduleUpdateNone                     = C.GIT_SUBMODULE_UPDATE_NONE
)
View Source
const (
	SubmoduleIgnoreReset     SubmoduleIgnore = C.GIT_SUBMODULE_IGNORE_RESET
	SubmoduleIgnoreNone                      = C.GIT_SUBMODULE_IGNORE_NONE
	SubmoduleIgnoreUntracked                 = C.GIT_SUBMODULE_IGNORE_UNTRACKED
	SubmoduleIgnoreDirty                     = C.GIT_SUBMODULE_IGNORE_DIRTY
	SubmoduleIgnoreAll                       = C.GIT_SUBMODULE_IGNORE_ALL
)
View Source
const (
	SubmoduleStatusInHead          SubmoduleStatus = C.GIT_SUBMODULE_STATUS_IN_HEAD
	SubmoduleStatusInIndex                         = C.GIT_SUBMODULE_STATUS_IN_INDEX
	SubmoduleStatusInConfig                        = C.GIT_SUBMODULE_STATUS_IN_CONFIG
	SubmoduleStatusInWd                            = C.GIT_SUBMODULE_STATUS_IN_WD
	SubmoduleStatusIndexAdded                      = C.GIT_SUBMODULE_STATUS_INDEX_ADDED
	SubmoduleStatusIndexDeleted                    = C.GIT_SUBMODULE_STATUS_INDEX_DELETED
	SubmoduleStatusIndexModified                   = C.GIT_SUBMODULE_STATUS_INDEX_MODIFIED
	SubmoduleStatusWdUninitialized                 = C.GIT_SUBMODULE_STATUS_WD_UNINITIALIZED
	SubmoduleStatusWdAdded                         = C.GIT_SUBMODULE_STATUS_WD_ADDED
	SubmoduleStatusWdDeleted                       = C.GIT_SUBMODULE_STATUS_WD_DELETED
	SubmoduleStatusWdModified                      = C.GIT_SUBMODULE_STATUS_WD_MODIFIED
	SubmoduleStatusWdIndexModified                 = C.GIT_SUBMODULE_STATUS_WD_INDEX_MODIFIED
	SubmoduleStatusWdWdModified                    = C.GIT_SUBMODULE_STATUS_WD_WD_MODIFIED
	SubmoduleStatusWdUntracked                     = C.GIT_SUBMODULE_STATUS_WD_UNTRACKED
)
View Source
const (
	SubmoduleRecurseNo       SubmoduleRecurse = C.GIT_SUBMODULE_RECURSE_NO
	SubmoduleRecurseYes                       = C.GIT_SUBMODULE_RECURSE_YES
	SubmoduleRecurseOndemand                  = C.GIT_SUBMODULE_RECURSE_ONDEMAND
)
View Source
const (
	FilemodeNew            Filemode = C.GIT_FILEMODE_NEW
	FilemodeTree                    = C.GIT_FILEMODE_TREE
	FilemodeBlob                    = C.GIT_FILEMODE_BLOB
	FilemodeBlobExecutable          = C.GIT_FILEMODE_BLOB_EXECUTABLE
	FilemodeLink                    = C.GIT_FILEMODE_LINK
	FilemodeCommit                  = C.GIT_FILEMODE_COMMIT
)
View Source
const (
	SortNone        SortType = C.GIT_SORT_NONE
	SortTopological          = C.GIT_SORT_TOPOLOGICAL
	SortTime                 = C.GIT_SORT_TIME
	SortReverse              = C.GIT_SORT_REVERSE
)

Variables

View Source
var (
	ErrIterOver = errors.New("Iteration is over")
)

Functions

func CallbackGitTreeWalk

func CallbackGitTreeWalk(_root unsafe.Pointer, _entry unsafe.Pointer, ptr unsafe.Pointer) C.int

func Discover

func Discover(start string, across_fs bool, ceiling_dirs []string) (string, error)

func IsExist

func IsExist(err error) bool

func IsNotExist

func IsNotExist(err error) bool

func MakeGitError

func MakeGitError(errorCode C.int) error

func MakeGitError2

func MakeGitError2(err int) error

func RemoteIsValidName

func RemoteIsValidName(name string) bool

func ShortenOids

func ShortenOids(ids []*Oid, minlen int) (int, error)

func SubmoduleStatusIsUnmodified

func SubmoduleStatusIsUnmodified(status int) bool

func SubmoduleVisitor

func SubmoduleVisitor(csub unsafe.Pointer, name string, cfct unsafe.Pointer) int

Types

type Blob

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

func (*Blob) Contents

func (v *Blob) Contents() []byte

func (*Blob) Free

func (o *Blob) Free()

func (Blob) Id

func (o Blob) Id() *Oid

func (*Blob) Size

func (v *Blob) Size() int64

func (Blob) Type

func (o Blob) Type() ObjectType

type BlobCallbackData

type BlobCallbackData struct {
	Callback BlobChunkCallback
	Error    error
}

type BlobChunkCallback

type BlobChunkCallback func(maxLen int) ([]byte, error)

type Branch

type Branch struct {
	Reference
}

func (*Branch) Delete

func (b *Branch) Delete() error

func (*Branch) IsHead

func (b *Branch) IsHead() (bool, error)

func (*Branch) Move

func (b *Branch) Move(newBranchName string, force bool, signature *Signature, msg string) (*Branch, error)

func (*Branch) Name

func (b *Branch) Name() (string, error)

func (*Branch) SetUpstream

func (b *Branch) SetUpstream(upstreamName string) error

func (*Branch) Upstream

func (b *Branch) Upstream() (*Branch, error)

type BranchType

type BranchType uint
const (
	BranchLocal  BranchType = C.GIT_BRANCH_LOCAL
	BranchRemote            = C.GIT_BRANCH_REMOTE
)

type CheckoutOpts

type CheckoutOpts struct {
	Strategy       CheckoutStrategy // Default will be a dry run
	DisableFilters bool             // Don't apply filters like CRLF conversion
	DirMode        os.FileMode      // Default is 0755
	FileMode       os.FileMode      // Default is 0644 or 0755 as dictated by blob
	FileOpenFlags  int              // Default is O_CREAT | O_TRUNC | O_WRONLY
}

type CheckoutStrategy

type CheckoutStrategy uint

type CloneOptions

type CloneOptions struct {
	*CheckoutOpts
	*RemoteCallbacks
	Bare             bool
	IgnoreCertErrors bool
	RemoteName       string
	CheckoutBranch   string
}

type Commit

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

Commit

func (Commit) Author

func (c Commit) Author() *Signature

func (Commit) Committer

func (c Commit) Committer() *Signature

func (*Commit) Free

func (o *Commit) Free()

func (Commit) Id

func (o Commit) Id() *Oid

func (Commit) Message

func (c Commit) Message() string

func (*Commit) Parent

func (c *Commit) Parent(n uint) *Commit

func (*Commit) ParentCount

func (c *Commit) ParentCount() uint

func (*Commit) ParentId

func (c *Commit) ParentId(n uint) *Oid

func (Commit) Tree

func (c Commit) Tree() (*Tree, error)

func (Commit) TreeId

func (c Commit) TreeId() *Oid

func (Commit) Type

func (o Commit) Type() ObjectType

type CompletionCallback

type CompletionCallback func(RemoteCompletion) int

type Config

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

func NewConfig

func NewConfig() (*Config, error)

NewConfig creates a new empty configuration object

func OpenOndisk

func OpenOndisk(parent *Config, path string) (*Config, error)

OpenOndisk creates a new config instance containing a single on-disk file

func (*Config) AddFile

func (c *Config) AddFile(path string, level ConfigLevel, force bool) error

AddFile adds a file-backed backend to the config object at the specified level.

func (*Config) Delete

func (c *Config) Delete(name string) error

func (*Config) Free

func (c *Config) Free()

func (*Config) LookupBool

func (c *Config) LookupBool(name string) (bool, error)

func (*Config) LookupInt32

func (c *Config) LookupInt32(name string) (int32, error)

func (*Config) LookupInt64

func (c *Config) LookupInt64(name string) (int64, error)

func (*Config) LookupString

func (c *Config) LookupString(name string) (string, error)

func (*Config) NewIterator

func (c *Config) NewIterator() (*ConfigIterator, error)

NewIterator creates an iterator over each entry in the configuration

func (*Config) NewIteratorGlob

func (c *Config) NewIteratorGlob(regexp string) (*ConfigIterator, error)

NewIteratorGlob creates an iterator over each entry in the configuration whose name matches the given regular expression

func (*Config) NewMultivarIterator

func (c *Config) NewMultivarIterator(name, regexp string) (*ConfigIterator, error)

func (*Config) OpenLevel

func (c *Config) OpenLevel(parent *Config, level ConfigLevel) (*Config, error)

OpenLevel creates a single-level focused config object from a multi-level one

func (*Config) Refresh

func (c *Config) Refresh() error

Refresh refreshes the configuration to reflect any changes made externally e.g. on disk

func (*Config) SetBool

func (c *Config) SetBool(name string, value bool) (err error)

func (*Config) SetInt32

func (c *Config) SetInt32(name string, value int32) (err error)

func (*Config) SetInt64

func (c *Config) SetInt64(name string, value int64) (err error)

func (*Config) SetMultivar

func (c *Config) SetMultivar(name, regexp, value string) (err error)

func (*Config) SetString

func (c *Config) SetString(name, value string) (err error)

type ConfigEntry

type ConfigEntry struct {
	Name  string
	Value string
	Level ConfigLevel
}

type ConfigIterator

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

func (*ConfigIterator) Free

func (iter *ConfigIterator) Free()

func (*ConfigIterator) Next

func (iter *ConfigIterator) Next() (*ConfigEntry, error)

Next returns the next entry for this iterator

type ConfigLevel

type ConfigLevel int
const (
	// System-wide configuration file; /etc/gitconfig on Linux systems
	ConfigLevelSystem ConfigLevel = C.GIT_CONFIG_LEVEL_SYSTEM

	// XDG compatible configuration file; typically ~/.config/git/config
	ConfigLevelXDG ConfigLevel = C.GIT_CONFIG_LEVEL_XDG

	// User-specific configuration file (also called Global configuration
	// file); typically ~/.gitconfig
	ConfigLevelGlobal ConfigLevel = C.GIT_CONFIG_LEVEL_GLOBAL

	// Repository specific configuration file; $WORK_DIR/.git/config on
	// non-bare repos
	ConfigLevelLocal ConfigLevel = C.GIT_CONFIG_LEVEL_LOCAL

	// Application specific configuration file; freely defined by applications
	ConfigLevelApp ConfigLevel = C.GIT_CONFIG_LEVEL_APP

	// Represents the highest level available config file (i.e. the most
	// specific config file available that actually is loaded)
	ConfigLevelHighest ConfigLevel = C.GIT_CONFIG_HIGHEST_LEVEL
)

type Cred

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

func NewCredDefault

func NewCredDefault() (int, Cred)

func NewCredSshKey

func NewCredSshKey(username string, publickey string, privatekey string, passphrase string) (int, Cred)

func NewCredSshKeyFromAgent

func NewCredSshKeyFromAgent(username string) (int, Cred)

func NewCredUserpassPlaintext

func NewCredUserpassPlaintext(username string, password string) (int, Cred)

func (*Cred) HasUsername

func (o *Cred) HasUsername() bool

func (*Cred) Type

func (o *Cred) Type() CredType

type CredType

type CredType uint

type CredentialsCallback

type CredentialsCallback func(url string, username_from_url string, allowed_types CredType) (int, *Cred)

type Filemode

type Filemode int

type GitError

type GitError struct {
	Message   string
	Class     int
	ErrorCode int
}

func (GitError) Error

func (e GitError) Error() string

type Index

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

func (*Index) AddByPath

func (v *Index) AddByPath(path string) error

func (*Index) AddConflict

func (v *Index) AddConflict(ancestor *IndexEntry, our *IndexEntry, their *IndexEntry) error

func (*Index) CleanupConflicts

func (v *Index) CleanupConflicts()

func (*Index) ConflictIterator

func (v *Index) ConflictIterator() (*IndexConflictIterator, error)

func (*Index) EntryByIndex

func (v *Index) EntryByIndex(index uint) (*IndexEntry, error)

func (*Index) EntryCount

func (v *Index) EntryCount() uint

func (*Index) Free

func (v *Index) Free()

func (*Index) GetConflict

func (v *Index) GetConflict(path string) (IndexConflict, error)

func (*Index) HasConflicts

func (v *Index) HasConflicts() bool

func (*Index) RemoveConflict

func (v *Index) RemoveConflict(path string) error

func (*Index) Write

func (v *Index) Write() error

func (*Index) WriteTree

func (v *Index) WriteTree() (*Oid, error)

func (*Index) WriteTreeTo

func (v *Index) WriteTreeTo(repo *Repository) (*Oid, error)

type IndexConflict

type IndexConflict struct {
	Ancestor *IndexEntry
	Our      *IndexEntry
	Their    *IndexEntry
}

type IndexConflictIterator

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

func (*IndexConflictIterator) Free

func (v *IndexConflictIterator) Free()

func (*IndexConflictIterator) Index

func (v *IndexConflictIterator) Index() *Index

func (*IndexConflictIterator) Next

type IndexEntry

type IndexEntry struct {
	Ctime time.Time
	Mtime time.Time
	Mode  uint
	Uid   uint
	Gid   uint
	Size  uint
	Id    *Oid
	Path  string
}

type Object

type Object interface {
	Free()
	Id() *Oid
	Type() ObjectType
}

type ObjectType

type ObjectType int

func (ObjectType) String

func (t ObjectType) String() string

type Odb

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

func (*Odb) Exists

func (v *Odb) Exists(oid *Oid) bool

func (*Odb) ForEach

func (v *Odb) ForEach() chan *Oid

func (*Odb) Free

func (v *Odb) Free()

func (*Odb) Hash

func (v *Odb) Hash(data []byte, otype ObjectType) (oid *Oid, err error)

Hash determines the object-ID (sha1) of a data buffer.

func (*Odb) NewReadStream

func (v *Odb) NewReadStream(id *Oid) (*OdbReadStream, error)

NewReadStream opens a read stream from the ODB. Reading from it will give you the contents of the object.

func (*Odb) NewWriteStream

func (v *Odb) NewWriteStream(size int, otype ObjectType) (*OdbWriteStream, error)

NewWriteStream opens a write stream to the ODB, which allows you to create a new object in the database. The size and type must be known in advance

func (*Odb) Read

func (v *Odb) Read(oid *Oid) (obj *OdbObject, err error)

func (*Odb) Write

func (v *Odb) Write(data []byte, otype ObjectType) (oid *Oid, err error)

type OdbObject

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

func (*OdbObject) Data

func (object *OdbObject) Data() (data []byte)

func (*OdbObject) Free

func (v *OdbObject) Free()

func (*OdbObject) Id

func (object *OdbObject) Id() (oid *Oid)

func (*OdbObject) Len

func (object *OdbObject) Len() (len uint64)

type OdbReadStream

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

func (*OdbReadStream) Close

func (stream *OdbReadStream) Close() error

Close is a dummy function in order to implement the Closer and ReadCloser interfaces

func (*OdbReadStream) Free

func (stream *OdbReadStream) Free()

func (*OdbReadStream) Read

func (stream *OdbReadStream) Read(data []byte) (int, error)

Read reads from the stream

type OdbWriteStream

type OdbWriteStream struct {
	Id Oid
	// contains filtered or unexported fields
}

func (*OdbWriteStream) Close

func (stream *OdbWriteStream) Close() error

Close signals that all the data has been written and stores the resulting object id in the stream's Id field.

func (*OdbWriteStream) Free

func (stream *OdbWriteStream) Free()

func (*OdbWriteStream) Write

func (stream *OdbWriteStream) Write(data []byte) (int, error)

Write writes to the stream

type Oid

type Oid [20]byte

Oid represents the id for a Git object.

func NewOid

func NewOid(s string) (*Oid, error)

func NewOidFromBytes

func NewOidFromBytes(b []byte) *Oid

func (*Oid) Cmp

func (oid *Oid) Cmp(oid2 *Oid) int

func (*Oid) Copy

func (oid *Oid) Copy() *Oid

func (*Oid) Equal

func (oid *Oid) Equal(oid2 *Oid) bool

func (*Oid) IsZero

func (oid *Oid) IsZero() bool

func (*Oid) NCmp

func (oid *Oid) NCmp(oid2 *Oid, n uint) int

func (*Oid) String

func (oid *Oid) String() string

type Packbuilder

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

func (*Packbuilder) ForEach

func (pb *Packbuilder) ForEach() (<-chan []byte, chan<- bool)

Foreach sends the packfile as slices through the "data" channel. If you want to stop the pack-building process (e.g. there's an error writing to the output), close or write a value into the "stop" channel.

func (*Packbuilder) Free

func (pb *Packbuilder) Free()

func (*Packbuilder) Insert

func (pb *Packbuilder) Insert(id *Oid, name string) error

func (*Packbuilder) InsertCommit

func (pb *Packbuilder) InsertCommit(id *Oid) error

func (*Packbuilder) InsertTree

func (pb *Packbuilder) InsertTree(id *Oid) error

func (*Packbuilder) ObjectCount

func (pb *Packbuilder) ObjectCount() uint32

func (*Packbuilder) Write

func (pb *Packbuilder) Write(w io.Writer) error

func (*Packbuilder) WriteToFile

func (pb *Packbuilder) WriteToFile(name string, mode os.FileMode) error

func (*Packbuilder) Written

func (pb *Packbuilder) Written() uint32

type PackbuilderProgressCallback

type PackbuilderProgressCallback func(stage int, current uint, total uint) int

type ProgressCallback

type ProgressCallback func(str string) int

type Push

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

func (*Push) AddRefspec

func (p *Push) AddRefspec(refspec string) error

func (*Push) Finish

func (p *Push) Finish() error

func (*Push) Free

func (p *Push) Free()

func (*Push) SetCallbacks

func (p *Push) SetCallbacks(callbacks PushCallbacks)

func (*Push) SetOptions

func (p *Push) SetOptions(opts PushOptions) error

func (*Push) StatusForeach

func (p *Push) StatusForeach(callback StatusForeachFunc) error

func (*Push) UnpackOk

func (p *Push) UnpackOk() bool

func (*Push) UpdateTips

func (p *Push) UpdateTips(sig *Signature, msg string) error

type PushCallbacks

type PushCallbacks struct {
	PackbuilderProgress *PackbuilderProgressCallback
	TransferProgress    *PushTransferProgressCallback
}

type PushOptions

type PushOptions struct {
	Version       uint
	PbParallelism uint
}

type PushTransferProgressCallback

type PushTransferProgressCallback func(current uint, total uint, bytes uint) int

type Reference

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

func (*Reference) Cmp

func (v *Reference) Cmp(ref2 *Reference) int

Cmp compares both references, retursn 0 on equality, otherwise a stable sorting.

func (*Reference) Delete

func (v *Reference) Delete() error

func (*Reference) Free

func (v *Reference) Free()

func (*Reference) IsBranch

func (v *Reference) IsBranch() bool

func (*Reference) IsRemote

func (v *Reference) IsRemote() bool

func (*Reference) IsTag

func (v *Reference) IsTag() bool

func (*Reference) Name

func (v *Reference) Name() string

func (*Reference) Rename

func (v *Reference) Rename(name string, force bool, sig *Signature, msg string) (*Reference, error)

func (*Reference) Resolve

func (v *Reference) Resolve() (*Reference, error)

func (*Reference) SetSymbolicTarget

func (v *Reference) SetSymbolicTarget(target string, sig *Signature, msg string) (*Reference, error)

func (*Reference) SetTarget

func (v *Reference) SetTarget(target *Oid, sig *Signature, msg string) (*Reference, error)

func (*Reference) Shorthand

func (v *Reference) Shorthand() string

Shorthand returns a "human-readable" short reference name

func (*Reference) SymbolicTarget

func (v *Reference) SymbolicTarget() string

func (*Reference) Target

func (v *Reference) Target() *Oid

func (*Reference) Type

func (v *Reference) Type() ReferenceType

type ReferenceIterator

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

func (*ReferenceIterator) Free

func (v *ReferenceIterator) Free()

Free the reference iterator

func (*ReferenceIterator) Iter

func (v *ReferenceIterator) Iter() <-chan *Reference

Create a channel from the iterator. You can use range on the returned channel to iterate over all the references names. The channel will be closed in case any error is found.

func (*ReferenceIterator) NameIter

func (v *ReferenceIterator) NameIter() <-chan string

Create a channel from the iterator. You can use range on the returned channel to iterate over all the references names. The channel will be closed in case any error is found.

func (*ReferenceIterator) Next

func (v *ReferenceIterator) Next() (*Reference, error)

Next retrieves the next reference. If the iterationis over, the returned error is git.ErrIterOver

func (*ReferenceIterator) NextName

func (v *ReferenceIterator) NextName() (string, error)

NextName retrieves the next reference name. If the iteration is over, the returned error is git.ErrIterOver

type ReferenceType

type ReferenceType int
const (
	ReferenceSymbolic ReferenceType = C.GIT_REF_SYMBOLIC
	ReferenceOid                    = C.GIT_REF_OID
)

type Remote

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

func (*Remote) AddFetch

func (o *Remote) AddFetch(refspec string) error

func (*Remote) AddPush

func (o *Remote) AddPush(refspec string) error

func (*Remote) ClearRefspecs

func (o *Remote) ClearRefspecs()

func (*Remote) Fetch

func (o *Remote) Fetch(sig *Signature, msg string) error

func (*Remote) FetchRefspecs

func (o *Remote) FetchRefspecs() ([]string, error)

func (*Remote) Free

func (r *Remote) Free()

func (*Remote) Name

func (o *Remote) Name() string

func (*Remote) NewPush

func (remote *Remote) NewPush() (*Push, error)

func (*Remote) Owner

func (o *Remote) Owner() Repository

func (*Remote) PushRefspecs

func (o *Remote) PushRefspecs() ([]string, error)

func (*Remote) PushUrl

func (o *Remote) PushUrl() string

func (*Remote) RefspecCount

func (o *Remote) RefspecCount() uint

func (*Remote) Save

func (o *Remote) Save() error

func (*Remote) SetFetchRefspecs

func (o *Remote) SetFetchRefspecs(refspecs []string) error

func (*Remote) SetPushRefspecs

func (o *Remote) SetPushRefspecs(refspecs []string) error

func (*Remote) SetPushUrl

func (o *Remote) SetPushUrl(url string) error

func (*Remote) SetUrl

func (o *Remote) SetUrl(url string) error

func (*Remote) Url

func (o *Remote) Url() string

type RemoteCompletion

type RemoteCompletion uint

type Repository

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

Repository

func Clone

func Clone(url string, path string, options *CloneOptions) (*Repository, error)

func InitRepository

func InitRepository(path string, isbare bool) (*Repository, error)

func OpenRepository

func OpenRepository(path string) (*Repository, error)

func OpenRepositoryExtended

func OpenRepositoryExtended(path string) (*Repository, error)

func (*Repository) AddSubmodule

func (repo *Repository) AddSubmodule(url, path string, use_git_link bool) (*Submodule, error)

func (*Repository) CheckoutHead

func (v *Repository) CheckoutHead(opts *CheckoutOpts) error

Updates files in the index and the working tree to match the content of the commit pointed at by HEAD. opts may be nil.

func (*Repository) CheckoutIndex

func (v *Repository) CheckoutIndex(index *Index, opts *CheckoutOpts) error

Updates files in the working tree to match the content of the given index. If index is nil, the repository's index will be used. opts may be nil.

func (*Repository) Config

func (v *Repository) Config() (*Config, error)

func (*Repository) CreateAnonymousRemote

func (repo *Repository) CreateAnonymousRemote(url, fetch string) (*Remote, error)

func (*Repository) CreateBlobFromBuffer

func (repo *Repository) CreateBlobFromBuffer(data []byte) (*Oid, error)

func (*Repository) CreateBlobFromChunks

func (repo *Repository) CreateBlobFromChunks(hintPath string, callback BlobChunkCallback) (*Oid, error)

func (*Repository) CreateBranch

func (repo *Repository) CreateBranch(branchName string, target *Commit, force bool, signature *Signature, msg string) (*Reference, error)

func (*Repository) CreateCommit

func (v *Repository) CreateCommit(
	refname string, author, committer *Signature,
	message string, tree *Tree, parents ...*Commit) (*Oid, error)

func (*Repository) CreateReference

func (v *Repository) CreateReference(name string, id *Oid, force bool, sig *Signature, msg string) (*Reference, error)

func (*Repository) CreateRemote

func (repo *Repository) CreateRemote(name string, url string) (*Remote, error)

func (*Repository) CreateRemoteWithFetchspec

func (repo *Repository) CreateRemoteWithFetchspec(name string, url string, fetch string) (*Remote, error)

func (*Repository) CreateSymbolicReference

func (v *Repository) CreateSymbolicReference(name, target string, force bool, sig *Signature, msg string) (*Reference, error)

func (*Repository) DwimReference

func (v *Repository) DwimReference(name string) (*Reference, error)

DwimReference looks up a reference by DWIMing its short name

func (*Repository) EnsureLog

func (v *Repository) EnsureLog(name string) error

EnsureLog ensures that there is a reflog for the given reference name and creates an empty one if necessary.

func (*Repository) ForeachSubmodule

func (repo *Repository) ForeachSubmodule(cbk SubmoduleCbk) error

func (*Repository) Free

func (v *Repository) Free()

func (*Repository) HasLog

func (v *Repository) HasLog(name string) (bool, error)

HasLog returns whether there is a reflog for the given reference name

func (*Repository) Index

func (v *Repository) Index() (*Index, error)

func (*Repository) IsBare

func (repo *Repository) IsBare() bool

func (*Repository) ListRemotes

func (repo *Repository) ListRemotes() ([]string, error)

func (*Repository) LoadRemote

func (repo *Repository) LoadRemote(name string) (*Remote, error)

func (*Repository) Lookup

func (v *Repository) Lookup(id *Oid) (Object, error)

func (*Repository) LookupBlob

func (v *Repository) LookupBlob(id *Oid) (*Blob, error)

func (*Repository) LookupBranch

func (repo *Repository) LookupBranch(branchName string, bt BranchType) (*Branch, error)

func (*Repository) LookupCommit

func (v *Repository) LookupCommit(id *Oid) (*Commit, error)

func (*Repository) LookupReference

func (v *Repository) LookupReference(name string) (*Reference, error)

func (*Repository) LookupSubmodule

func (repo *Repository) LookupSubmodule(name string) (*Submodule, error)

func (*Repository) LookupTree

func (v *Repository) LookupTree(id *Oid) (*Tree, error)

func (*Repository) NewPackbuilder

func (repo *Repository) NewPackbuilder() (*Packbuilder, error)

func (*Repository) NewReferenceIterator

func (repo *Repository) NewReferenceIterator() (*ReferenceIterator, error)

NewReferenceIterator creates a new iterator over reference names

func (*Repository) NewReferenceIteratorGlob

func (repo *Repository) NewReferenceIteratorGlob(glob string) (*ReferenceIterator, error)

NewReferenceIteratorGlob creates an iterator over reference names that match the speicified glob. The glob is of the usual fnmatch type.

func (*Repository) Odb

func (v *Repository) Odb() (odb *Odb, err error)

func (*Repository) Path

func (repo *Repository) Path() string

func (*Repository) ReloadAllSubmodules

func (repo *Repository) ReloadAllSubmodules(force bool) error

func (*Repository) RemoteName

func (repo *Repository) RemoteName(canonicalBranchName string) (string, error)

func (*Repository) RevparseSingle

func (v *Repository) RevparseSingle(spec string) (Object, error)

func (*Repository) SetWorkdir

func (repo *Repository) SetWorkdir(workdir string, updateGitlink bool) error

func (*Repository) TreeBuilder

func (v *Repository) TreeBuilder() (*TreeBuilder, error)

func (*Repository) TreeBuilderFromTree

func (v *Repository) TreeBuilderFromTree(tree *Tree) (*TreeBuilder, error)

func (*Repository) UpstreamName

func (repo *Repository) UpstreamName(canonicalBranchName string) (string, error)

func (*Repository) Walk

func (v *Repository) Walk() (*RevWalk, error)

func (*Repository) Workdir

func (repo *Repository) Workdir() string

type RevWalk

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

func (*RevWalk) Free

func (v *RevWalk) Free()

func (*RevWalk) Hide

func (v *RevWalk) Hide(id *Oid) error

func (*RevWalk) HideGlob

func (v *RevWalk) HideGlob(glob string) error

func (*RevWalk) HideHead

func (v *RevWalk) HideHead() (err error)

func (*RevWalk) HideRef

func (v *RevWalk) HideRef(r string) error

func (*RevWalk) Iterate

func (v *RevWalk) Iterate(fun RevWalkIterator) (err error)

func (*RevWalk) Next

func (v *RevWalk) Next(id *Oid) (err error)

func (*RevWalk) Push

func (v *RevWalk) Push(id *Oid) error

func (*RevWalk) PushGlob

func (v *RevWalk) PushGlob(glob string) error

func (*RevWalk) PushHead

func (v *RevWalk) PushHead() (err error)

func (*RevWalk) PushRange

func (v *RevWalk) PushRange(r string) error

func (*RevWalk) PushRef

func (v *RevWalk) PushRef(r string) error

func (*RevWalk) Reset

func (v *RevWalk) Reset()

func (*RevWalk) Sorting

func (v *RevWalk) Sorting(sm SortType)

type RevWalkIterator

type RevWalkIterator func(commit *Commit) bool

type Signature

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

func (*Signature) Offset

func (v *Signature) Offset() int

the offset in mintes, which is what git wants

type SortType

type SortType uint

type StatusForeachFunc

type StatusForeachFunc func(ref string, msg string) int

type Submodule

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

Submodule

func (*Submodule) AddToIndex

func (sub *Submodule) AddToIndex(write_index bool) error

func (*Submodule) FetchRecurseSubmodules

func (sub *Submodule) FetchRecurseSubmodules() SubmoduleRecurse

func (*Submodule) FinalizeAdd

func (sub *Submodule) FinalizeAdd() error

func (*Submodule) HeadId

func (sub *Submodule) HeadId() *Oid

func (*Submodule) Ignore

func (sub *Submodule) Ignore() SubmoduleIgnore

func (*Submodule) IndexId

func (sub *Submodule) IndexId() *Oid

func (*Submodule) Init

func (sub *Submodule) Init(overwrite bool) error

func (*Submodule) Name

func (sub *Submodule) Name() string

func (*Submodule) Open

func (sub *Submodule) Open() (*Repository, error)

func (*Submodule) Owner

func (sub *Submodule) Owner() *Repository

func (*Submodule) Path

func (sub *Submodule) Path() string

func (*Submodule) Reload

func (sub *Submodule) Reload(force bool) error

func (*Submodule) Save

func (sub *Submodule) Save() error

func (*Submodule) SetFetchRecurseSubmodules

func (sub *Submodule) SetFetchRecurseSubmodules(recurse SubmoduleRecurse) error

func (*Submodule) SetIgnore

func (sub *Submodule) SetIgnore(ignore SubmoduleIgnore) SubmoduleIgnore

func (*Submodule) SetUpdate

func (sub *Submodule) SetUpdate(update SubmoduleUpdate) SubmoduleUpdate

func (*Submodule) SetUrl

func (sub *Submodule) SetUrl(url string) error

func (*Submodule) Sync

func (sub *Submodule) Sync() error

func (*Submodule) Update

func (sub *Submodule) Update() SubmoduleUpdate

func (*Submodule) Url

func (sub *Submodule) Url() string

func (*Submodule) WdId

func (sub *Submodule) WdId() *Oid

type SubmoduleCbk

type SubmoduleCbk func(sub *Submodule, name string) int

type SubmoduleIgnore

type SubmoduleIgnore int

type SubmoduleRecurse

type SubmoduleRecurse int

type SubmoduleStatus

type SubmoduleStatus int

type SubmoduleUpdate

type SubmoduleUpdate int

type TransferProgress

type TransferProgress struct {
	TotalObjects    uint
	IndexedObjects  uint
	ReceivedObjects uint
	LocalObjects    uint
	TotalDeltas     uint
	ReceivedBytes   uint
}

type TransferProgressCallback

type TransferProgressCallback func(stats TransferProgress) int

type Tree

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

func (Tree) EntryByIndex

func (t Tree) EntryByIndex(index uint64) *TreeEntry

func (Tree) EntryByName

func (t Tree) EntryByName(filename string) *TreeEntry

func (Tree) EntryByPath

func (t Tree) EntryByPath(path string) (*TreeEntry, error)

EntryByPath looks up an entry by its full path, recursing into deeper trees if necessary (i.e. if there are slashes in the path)

func (Tree) EntryCount

func (t Tree) EntryCount() uint64

func (*Tree) Free

func (o *Tree) Free()

func (Tree) Id

func (o Tree) Id() *Oid

func (Tree) Type

func (o Tree) Type() ObjectType

func (Tree) Walk

func (t Tree) Walk(callback TreeWalkCallback) error

type TreeBuilder

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

func (*TreeBuilder) Free

func (v *TreeBuilder) Free()

func (*TreeBuilder) Insert

func (v *TreeBuilder) Insert(filename string, id *Oid, filemode int) error

func (*TreeBuilder) Remove

func (v *TreeBuilder) Remove(filename string) error

func (*TreeBuilder) Write

func (v *TreeBuilder) Write() (*Oid, error)

type TreeEntry

type TreeEntry struct {
	Name     string
	Id       *Oid
	Type     ObjectType
	Filemode int
}

type TreeWalkCallback

type TreeWalkCallback func(string, *TreeEntry) int

type UpdateTipsCallback

type UpdateTipsCallback func(refname string, a *Oid, b *Oid) int

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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