Documentation ¶
Index ¶
- Constants
- Variables
- func CachedMemory() (current int, allowed int, err error)
- func CallbackGitTreeWalk(_root *C.char, entry *C.git_tree_entry, ptr unsafe.Pointer) C.intdeprecated
- func ConfigFindGlobal() (string, error)
- func ConfigFindProgramdata() (string, error)
- func ConfigFindSystem() (string, error)
- func ConfigFindXDG() (string, error)
- func DiffBlobs(oldBlob *Blob, oldAsPath string, newBlob *Blob, newAsPath string, ...) error
- func Discover(start string, across_fs bool, ceiling_dirs []string) (string, error)
- func EnableCaching(enabled bool) error
- func EnableFsyncGitDir(enabled bool) error
- func EnableStrictHashVerification(enabled bool) error
- func GetCachedMemory() (current int, allowed int, err error)
- func IsErrorClass(err error, c ErrorClass) bool
- func IsErrorCode(err error, c ErrorCode) bool
- func MakeGitError(c C.int) error
- func MakeGitError2(err int) error
- func MwindowMappedLimit() (int, error)
- func MwindowSize() (int, error)
- func ReInit()
- func ReferenceIsValidName(name string) bool
- func ReferenceNormalizeName(name string, flags ReferenceFormat) (string, error)
- func RemoteIsValidName(name string) bool
- func SearchPath(level ConfigLevel) (string, error)
- func SetCacheMaxSize(maxSize int) error
- func SetCacheObjectLimit(objectType ObjectType, size int) error
- func SetMwindowMappedLimit(size int) error
- func SetMwindowSize(size int) error
- func SetSearchPath(level ConfigLevel, path string) error
- func ShortenOids(ids []*Oid, minlen int) (int, error)
- func Shutdown()
- func SubmoduleStatusIsUnmodified(status int) bool
- func SubmoduleVisitor(csub unsafe.Pointer, name *C.char, handle unsafe.Pointer) C.intdeprecated
- type AnnotatedCommit
- type ApplyDeltaCallback
- type ApplyHunkCallback
- type ApplyLocation
- type ApplyOptions
- type Blame
- type BlameHunk
- type BlameOptions
- type BlameOptionsFlag
- type Blob
- type BlobCallbackDatadeprecated
- type BlobChunkCallbackdeprecated
- type BlobWriteStream
- type Branch
- type BranchIterator
- type BranchIteratorFunc
- type BranchType
- type Certificate
- type CertificateCheckCallback
- type CertificateKind
- type CheckoutNotifyCallback
- type CheckoutNotifyType
- type CheckoutOptions
- type CheckoutOptsdeprecated
- type CheckoutProgressCallback
- type CheckoutStrategy
- type CherrypickOptions
- type CloneOptions
- type Commit
- func (c *Commit) Amend(refname string, author, committer *Signature, message string, tree *Tree) (*Oid, error)
- func (c *Commit) AsObject() *Object
- func (c *Commit) Author() *Signature
- func (c *Commit) Committer() *Signature
- func (c *Commit) ContentToSign() string
- func (c *Commit) Describe(opts *DescribeOptions) (*DescribeResult, error)
- func (c *Commit) ExtractSignature() (string, string, error)
- func (c *Commit) Message() string
- func (c *Commit) MessageEncoding() string
- func (c *Commit) Parent(n uint) *Commit
- func (c *Commit) ParentCount() uint
- func (c *Commit) ParentId(n uint) *Oid
- func (c *Commit) RawHeader() string
- func (c *Commit) RawMessage() string
- func (c *Commit) Summary() string
- func (c *Commit) Tree() (*Tree, error)
- func (c *Commit) TreeId() *Oid
- func (c *Commit) WithSignature(signature string, signatureField string) (*Oid, error)
- func (c *Commit) WithSignatureUsing(f CommitSigningCallback) (*Oid, error)
- type CommitSigningCallback
- type CompletionCallback
- type Config
- func (c *Config) AddFile(path string, level ConfigLevel, force bool) error
- func (c *Config) Delete(name string) error
- func (c *Config) Free()
- func (c *Config) LookupBool(name string) (bool, error)
- func (c *Config) LookupInt32(name string) (int32, error)
- func (c *Config) LookupInt64(name string) (int64, error)
- func (c *Config) LookupString(name string) (string, error)
- func (c *Config) NewIterator() (*ConfigIterator, error)
- func (c *Config) NewIteratorGlob(regexp string) (*ConfigIterator, error)
- func (c *Config) NewMultivarIterator(name, regexp string) (*ConfigIterator, error)
- func (c *Config) OpenLevel(parent *Config, level ConfigLevel) (*Config, error)
- func (c *Config) SetBool(name string, value bool) (err error)
- func (c *Config) SetInt32(name string, value int32) (err error)
- func (c *Config) SetInt64(name string, value int64) (err error)
- func (c *Config) SetMultivar(name, regexp, value string) (err error)
- func (c *Config) SetString(name, value string) (err error)
- type ConfigEntry
- type ConfigIterator
- type ConfigLevel
- type ConnectDirection
- type Creddeprecated
- func NewCredDefault() (*Cred, error)deprecated
- func NewCredSshKey(username string, publicKeyPath string, privateKeyPath string, ...) (*Cred, error)deprecated
- func NewCredSshKeyFromAgent(username string) (*Cred, error)deprecated
- func NewCredSshKeyFromMemory(username string, publicKey string, privateKey string, passphrase string) (*Cred, error)deprecated
- func NewCredUsername(username string) (*Cred, error)deprecated
- func NewCredUserpassPlaintext(username string, password string) (*Cred, error)deprecated
- type CredTypedeprecated
- type Credential
- func NewCredentialDefault() (*Credential, error)
- func NewCredentialSSHKey(username string, publicKeyPath string, privateKeyPath string, ...) (*Credential, error)
- func NewCredentialSSHKeyFromAgent(username string) (*Credential, error)
- func NewCredentialSSHKeyFromMemory(username string, publicKey string, privateKey string, passphrase string) (*Credential, error)
- func NewCredentialSSHKeyFromSigner(username string, signer ssh.Signer) (*Credential, error)
- func NewCredentialUsername(username string) (*Credential, error)
- func NewCredentialUserpassPlaintext(username string, password string) (*Credential, error)
- type CredentialType
- type CredentialsCallback
- type Delta
- type DescribeFormatOptions
- type DescribeOptions
- type DescribeOptionsStrategy
- type DescribeResult
- type Diff
- func (diff *Diff) Delta(index int) (DiffDelta, error)
- func (diff *Diff) FindSimilar(opts *DiffFindOptions) error
- func (diff *Diff) ForEach(cbFile DiffForEachFileCallback, detail DiffDetail) error
- func (diff *Diff) Free() error
- func (diff *Diff) GetDelta(index int) (DiffDelta, error)
- func (diff *Diff) NumDeltas() (int, error)
- func (diff *Diff) Patch(deltaIndex int) (*Patch, error)
- func (diff *Diff) Stats() (*DiffStats, error)
- func (diff *Diff) ToBuf(format DiffFormat) ([]byte, error)
- type DiffDelta
- type DiffDetail
- type DiffFile
- type DiffFindOptions
- type DiffFindOptionsFlag
- type DiffFlag
- type DiffForEachFileCallback
- type DiffForEachHunkCallback
- type DiffForEachLineCallback
- type DiffFormat
- type DiffHunk
- type DiffLine
- type DiffLineType
- type DiffNotifyCallback
- type DiffOptions
- type DiffOptionsFlag
- type DiffStats
- type DiffStatsFormat
- type DownloadTags
- type ErrorClass
- type ErrorCode
- type Feature
- type FetchOptions
- type FetchPrune
- type Filemode
- type GitError
- type HandleList
- type HostkeyCertificate
- type HostkeyKind
- type Index
- func (v *Index) Add(entry *IndexEntry) error
- func (v *Index) AddAll(pathspecs []string, flags IndexAddOption, callback IndexMatchedPathCallback) error
- func (v *Index) AddByPath(path string) error
- func (v *Index) AddConflict(ancestor *IndexEntry, our *IndexEntry, their *IndexEntry) error
- func (v *Index) AddFromBuffer(entry *IndexEntry, buffer []byte) error
- func (v *Index) CleanupConflicts()
- func (v *Index) Clear() error
- func (v *Index) Conflict(path string) (IndexConflict, error)
- func (v *Index) ConflictIterator() (*IndexConflictIterator, error)
- func (v *Index) EntryByIndex(index uint) (*IndexEntry, error)
- func (v *Index) EntryByPath(path string, stage int) (*IndexEntry, error)
- func (v *Index) EntryCount() uint
- func (v *Index) Find(path string) (uint, error)
- func (v *Index) FindPrefix(prefix string) (uint, error)
- func (v *Index) Free()
- func (v *Index) GetConflict(path string) (IndexConflict, error)
- func (v *Index) HasConflicts() bool
- func (v *Index) Path() string
- func (v *Index) ReadTree(tree *Tree) error
- func (v *Index) RemoveAll(pathspecs []string, callback IndexMatchedPathCallback) error
- func (v *Index) RemoveByPath(path string) error
- func (v *Index) RemoveConflict(path string) error
- func (v *Index) RemoveDirectory(dir string, stage int) error
- func (v *Index) UpdateAll(pathspecs []string, callback IndexMatchedPathCallback) error
- func (v *Index) Write() error
- func (v *Index) WriteTree() (*Oid, error)
- func (v *Index) WriteTreeTo(repo *Repository) (*Oid, error)
- type IndexAddOption
- type IndexAddOptsdeprecated
- type IndexConflict
- type IndexConflictIterator
- type IndexEntry
- type IndexMatchedPathCallback
- type IndexStageOptsdeprecated
- type IndexStageState
- type IndexTime
- type Indexer
- type Mempack
- type MergeAnalysis
- type MergeFileFavor
- type MergeFileFlags
- type MergeFileInput
- type MergeFileOptions
- type MergeFileResult
- type MergeOptions
- type MergePreference
- type MergeTreeFlag
- type MessageEncoding
- type Note
- type NoteCollection
- func (c *NoteCollection) Create(ref string, author, committer *Signature, id *Oid, note string, force bool) (*Oid, error)
- func (c *NoteCollection) DefaultRef() (string, error)
- func (c *NoteCollection) Read(ref string, id *Oid) (*Note, error)
- func (c *NoteCollection) Remove(ref string, author, committer *Signature, id *Oid) error
- type NoteIterator
- type Object
- func (o *Object) AsBlob() (*Blob, error)
- func (o *Object) AsCommit() (*Commit, error)
- func (o *Object) AsTag() (*Tag, error)
- func (o *Object) AsTree() (*Tree, error)
- func (o *Object) Free()
- func (o *Object) Id() *Oid
- func (o *Object) Owner() *Repository
- func (o *Object) Peel(t ObjectType) (*Object, error)
- func (o *Object) ShortId() (string, error)
- func (o *Object) Type() ObjectType
- type ObjectType
- type Objecter
- type Odb
- func (v *Odb) AddAlternate(backend *OdbBackend, priority int) (err error)
- func (v *Odb) AddBackend(backend *OdbBackend, priority int) (err error)
- func (v *Odb) Exists(oid *Oid) bool
- func (v *Odb) ForEach(callback OdbForEachCallback) error
- func (v *Odb) Free()
- func (v *Odb) Hash(data []byte, otype ObjectType) (oid *Oid, err error)
- func (v *Odb) NewReadStream(id *Oid) (*OdbReadStream, error)
- func (v *Odb) NewWritePack(callback TransferProgressCallback) (*OdbWritepack, error)
- func (v *Odb) NewWriteStream(size int64, otype ObjectType) (*OdbWriteStream, error)
- func (v *Odb) Read(oid *Oid) (obj *OdbObject, err error)
- func (v *Odb) ReadHeader(oid *Oid) (uint64, ObjectType, error)
- func (v *Odb) Write(data []byte, otype ObjectType) (oid *Oid, err error)
- type OdbBackend
- type OdbForEachCallback
- type OdbObject
- type OdbReadStream
- type OdbWriteStream
- type OdbWritepack
- type Oid
- type Packbuilder
- func (pb *Packbuilder) ForEach(callback PackbuilderForeachCallback) error
- func (pb *Packbuilder) Free()
- func (pb *Packbuilder) Insert(id *Oid, name string) error
- func (pb *Packbuilder) InsertCommit(id *Oid) error
- func (pb *Packbuilder) InsertTree(id *Oid) error
- func (pb *Packbuilder) InsertWalk(walk *RevWalk) error
- func (pb *Packbuilder) ObjectCount() uint32
- func (pb *Packbuilder) Write(w io.Writer) error
- func (pb *Packbuilder) WriteToFile(name string, mode os.FileMode) error
- func (pb *Packbuilder) Written() uint32
- type PackbuilderForeachCallback
- type PackbuilderProgressCallback
- type Patch
- type ProxyOptions
- type ProxyType
- type PushOptions
- type PushTransferProgressCallback
- type PushUpdateReferenceCallback
- type Rebase
- func (rebase *Rebase) Abort() error
- func (rebase *Rebase) Commit(ID *Oid, author, committer *Signature, message string) error
- func (rebase *Rebase) CurrentOperationIndex() (uint, error)
- func (rebase *Rebase) Finish() error
- func (r *Rebase) Free()
- func (rebase *Rebase) InmemoryIndex() (*Index, error)
- func (rebase *Rebase) Next() (*RebaseOperation, error)
- func (rebase *Rebase) OperationAt(index uint) *RebaseOperation
- func (rebase *Rebase) OperationCount() uint
- type RebaseOperation
- type RebaseOperationType
- type RebaseOptions
- type Refdb
- type RefdbBackend
- type Reference
- func (r *Reference) Branch() *Branch
- func (v *Reference) Cmp(ref2 *Reference) int
- func (v *Reference) Delete() error
- func (v *Reference) Free()
- func (v *Reference) IsBranch() bool
- func (v *Reference) IsNote() bool
- func (v *Reference) IsRemote() bool
- func (v *Reference) IsTag() bool
- func (v *Reference) Name() string
- func (v *Reference) Owner() *Repository
- func (v *Reference) Peel(t ObjectType) (*Object, error)
- func (v *Reference) Rename(name string, force bool, msg string) (*Reference, error)
- func (v *Reference) Resolve() (*Reference, error)
- func (v *Reference) SetSymbolicTarget(target string, msg string) (*Reference, error)
- func (v *Reference) SetTarget(target *Oid, msg string) (*Reference, error)
- func (v *Reference) Shorthand() string
- func (v *Reference) SymbolicTarget() string
- func (v *Reference) Target() *Oid
- func (v *Reference) Type() ReferenceType
- type ReferenceCollection
- func (c *ReferenceCollection) Create(name string, id *Oid, force bool, msg string) (*Reference, error)
- func (c *ReferenceCollection) CreateSymbolic(name, target string, force bool, msg string) (*Reference, error)
- func (c *ReferenceCollection) Dwim(name string) (*Reference, error)
- func (c *ReferenceCollection) EnsureLog(name string) error
- func (c *ReferenceCollection) HasLog(name string) (bool, error)
- func (c *ReferenceCollection) Lookup(name string) (*Reference, error)
- type ReferenceFormat
- type ReferenceIterator
- type ReferenceNameIterator
- type ReferenceType
- type Refspec
- func (s *Refspec) Direction() ConnectDirection
- func (s *Refspec) Dst() string
- func (s *Refspec) DstMatches(refname string) bool
- func (s *Refspec) Force() bool
- func (s *Refspec) Free()
- func (s *Refspec) Rtransform(refname string) (string, error)
- func (s *Refspec) Src() string
- func (s *Refspec) SrcMatches(refname string) bool
- func (s *Refspec) String() string
- func (s *Refspec) Transform(refname string) (string, error)
- type RegisteredSmartTransport
- func NewRegisteredSmartTransport(name string, stateless bool, callback SmartSubtransportCallback) (*RegisteredSmartTransport, error)
- func RegisterManagedHTTPTransport(protocol string) (*RegisteredSmartTransport, error)
- func RegisterManagedSSHTransport(protocol string) (*RegisteredSmartTransport, error)
- type Remote
- func (o *Remote) Connect(direction ConnectDirection, callbacks *RemoteCallbacks, ...) error
- func (o *Remote) ConnectFetch(callbacks *RemoteCallbacks, proxyOpts *ProxyOptions, headers []string) error
- func (o *Remote) ConnectPush(callbacks *RemoteCallbacks, proxyOpts *ProxyOptions, headers []string) error
- func (o *Remote) Disconnect()
- func (o *Remote) Fetch(refspecs []string, opts *FetchOptions, msg string) error
- func (o *Remote) FetchRefspecs() ([]string, error)
- func (r *Remote) Free()
- func (o *Remote) Ls(filterRefs ...string) ([]RemoteHead, error)
- func (o *Remote) Name() string
- func (o *Remote) Prune(callbacks *RemoteCallbacks) error
- func (o *Remote) PruneRefs() bool
- func (o *Remote) Push(refspecs []string, opts *PushOptions) error
- func (o *Remote) PushRefspecs() ([]string, error)
- func (o *Remote) PushUrl() string
- func (o *Remote) RefspecCount() uint
- func (o *Remote) Url() string
- type RemoteCallbacks
- type RemoteCollection
- func (c *RemoteCollection) AddFetch(remote, refspec string) error
- func (c *RemoteCollection) AddPush(remote, refspec string) error
- func (c *RemoteCollection) Create(name string, url string) (*Remote, error)
- func (c *RemoteCollection) CreateAnonymous(url string) (*Remote, error)
- func (c *RemoteCollection) CreateWithFetchspec(name string, url string, fetch string) (*Remote, error)
- func (c *RemoteCollection) CreateWithOptions(url string, option *RemoteCreateOptions) (*Remote, error)
- func (c *RemoteCollection) Delete(name string) error
- func (c *RemoteCollection) Free()
- func (c *RemoteCollection) List() ([]string, error)
- func (c *RemoteCollection) Lookup(name string) (*Remote, error)
- func (c *RemoteCollection) Rename(remote, newname string) ([]string, error)
- func (c *RemoteCollection) SetPushUrl(remote, url string) error
- func (c *RemoteCollection) SetUrl(remote, url string) error
- type RemoteCompletion
- type RemoteCreateCallback
- type RemoteCreateOptions
- type RemoteCreateOptionsFlag
- type RemoteHead
- type Repository
- func Clone(url string, path string, options *CloneOptions) (*Repository, error)
- func InitRepository(path string, isbare bool) (*Repository, error)
- func NewRepositoryWrapOdb(odb *Odb) (repo *Repository, err error)
- func OpenRepository(path string) (*Repository, error)
- func OpenRepositoryExtended(path string, flags RepositoryOpenFlag, ceiling string) (*Repository, error)
- func (r *Repository) AddGitIgnoreRules(rules string) error
- func (v *Repository) AddIgnoreRule(rules string) error
- func (repo *Repository) AheadBehind(local, upstream *Oid) (ahead, behind int, err error)
- func (r *Repository) AnnotatedCommitFromFetchHead(branchName string, remoteURL string, oid *Oid) (*AnnotatedCommit, error)
- func (r *Repository) AnnotatedCommitFromRef(ref *Reference) (*AnnotatedCommit, error)
- func (r *Repository) AnnotatedCommitFromRevspec(spec string) (*AnnotatedCommit, error)
- func (v *Repository) ApplyDiff(diff *Diff, location ApplyLocation, opts *ApplyOptions) error
- func (v *Repository) ApplyToTree(diff *Diff, tree *Tree, opts *ApplyOptions) (*Index, error)
- func (v *Repository) BlameFile(path string, opts *BlameOptions) (*Blame, error)
- func (v *Repository) CheckoutHead(opts *CheckoutOptions) error
- func (v *Repository) CheckoutIndex(index *Index, opts *CheckoutOptions) error
- func (v *Repository) CheckoutTree(tree *Tree, opts *CheckoutOptions) error
- func (v *Repository) Cherrypick(commit *Commit, opts CherrypickOptions) error
- func (r *Repository) CherrypickCommit(pick, our *Commit, opts CherrypickOptions) (*Index, error)
- func (r *Repository) ClearGitIgnoreRules() error
- func (v *Repository) ClearInternalIgnoreRules() error
- func (v *Repository) Config() (*Config, error)
- func (repo *Repository) CreateBlobFromBuffer(data []byte) (*Oid, error)
- func (repo *Repository) CreateBranch(branchName string, target *Commit, force bool) (*Branch, error)
- func (v *Repository) CreateCommit(refname string, author, committer *Signature, message string, tree *Tree, ...) (*Oid, error)
- func (v *Repository) CreateCommitBuffer(author, committer *Signature, messageEncoding MessageEncoding, message string, ...) ([]byte, error)
- func (v *Repository) CreateCommitFromIds(refname string, author, committer *Signature, message string, tree *Oid, ...) (*Oid, error)
- func (v *Repository) CreateCommitWithSignature(commitContent, signature, signatureField string) (*Oid, error)
- func (repo *Repository) CreateFromStream(hintPath string) (*BlobWriteStream, error)
- func (repo *Repository) DefaultSignature() (*Signature, error)
- func (repo *Repository) DescendantOf(commit, ancestor *Oid) (bool, error)
- func (repo *Repository) DescribeWorkdir(opts *DescribeOptions) (*DescribeResult, error)
- func (v *Repository) DiffIndexToWorkdir(index *Index, opts *DiffOptions) (*Diff, error)
- func (v *Repository) DiffTreeToIndex(oldTree *Tree, index *Index, opts *DiffOptions) (*Diff, error)
- func (v *Repository) DiffTreeToTree(oldTree, newTree *Tree, opts *DiffOptions) (*Diff, error)
- func (v *Repository) DiffTreeToWorkdir(oldTree *Tree, opts *DiffOptions) (*Diff, error)
- func (v *Repository) DiffTreeToWorkdirWithIndex(oldTree *Tree, opts *DiffOptions) (*Diff, error)
- func (v *Repository) Free()
- func (v *Repository) Head() (*Reference, error)
- func (v *Repository) Index() (*Index, error)
- func (r *Repository) InitRebase(branch *AnnotatedCommit, upstream *AnnotatedCommit, onto *AnnotatedCommit, ...) (*Rebase, error)
- func (repo *Repository) IsBare() bool
- func (v *Repository) IsEmpty() (bool, error)
- func (v *Repository) IsHeadDetached() (bool, error)
- func (v *Repository) IsHeadUnborn() (bool, error)
- func (v *Repository) IsPathIgnored(path string) (bool, error)
- func (v *Repository) IsShallow() (bool, error)
- func (r *Repository) ItemPath(item RepositoryItem) (string, error)
- func (v *Repository) Lookup(id *Oid) (*Object, error)
- func (r *Repository) LookupAnnotatedCommit(oid *Oid) (*AnnotatedCommit, error)
- func (v *Repository) LookupBlob(id *Oid) (*Blob, error)
- func (repo *Repository) LookupBranch(branchName string, bt BranchType) (*Branch, error)
- func (v *Repository) LookupCommit(id *Oid) (*Commit, error)
- func (v *Repository) LookupPrefix(id *Oid, prefix uint) (*Object, error)
- func (v *Repository) LookupPrefixBlob(id *Oid, prefix uint) (*Blob, error)
- func (v *Repository) LookupPrefixCommit(id *Oid, prefix uint) (*Commit, error)
- func (v *Repository) LookupPrefixTag(id *Oid, prefix uint) (*Tag, error)
- func (v *Repository) LookupPrefixTree(id *Oid, prefix uint) (*Tree, error)
- func (v *Repository) LookupTag(id *Oid) (*Tag, error)
- func (v *Repository) LookupTree(id *Oid) (*Tree, error)
- func (r *Repository) Merge(theirHeads []*AnnotatedCommit, mergeOptions *MergeOptions, ...) error
- func (r *Repository) MergeAnalysis(theirHeads []*AnnotatedCommit) (MergeAnalysis, MergePreference, error)
- func (r *Repository) MergeBase(one *Oid, two *Oid) (*Oid, error)
- func (r *Repository) MergeBaseMany(oids []*Oid) (*Oid, error)
- func (r *Repository) MergeBaseOctopus(oids []*Oid) (*Oid, error)
- func (r *Repository) MergeBases(one, two *Oid) ([]*Oid, error)
- func (r *Repository) MergeBasesMany(oids []*Oid) ([]*Oid, error)
- func (r *Repository) MergeCommits(ours *Commit, theirs *Commit, options *MergeOptions) (*Index, error)
- func (r *Repository) MergeTrees(ancestor *Tree, ours *Tree, theirs *Tree, options *MergeOptions) (*Index, error)
- func (r *Repository) Message() (string, error)
- func (repo *Repository) NewBranchIterator(flags BranchType) (*BranchIterator, error)
- func (repo *Repository) NewNoteIterator(ref string) (*NoteIterator, error)
- func (repo *Repository) NewPackbuilder() (*Packbuilder, error)
- func (v *Repository) NewRefdb() (refdb *Refdb, err error)
- func (repo *Repository) NewReferenceIterator() (*ReferenceIterator, error)
- func (repo *Repository) NewReferenceIteratorGlob(glob string) (*ReferenceIterator, error)
- func (repo *Repository) NewReferenceNameIterator() (*ReferenceNameIterator, error)
- func (v *Repository) Odb() (odb *Odb, err error)
- func (r *Repository) OpenRebase(opts *RebaseOptions) (*Rebase, error)
- func (v *Repository) PatchFromBuffers(oldPath, newPath string, oldBuf, newBuf []byte, opts *DiffOptions) (*Patch, error)
- func (repo *Repository) Path() string
- func (repo *Repository) RemoteName(canonicalBranchName string) (string, error)
- func (r *Repository) RemoveMessage() error
- func (r *Repository) ResetDefaultToCommit(commit *Commit, pathspecs []string) error
- func (r *Repository) ResetToCommit(commit *Commit, resetType ResetType, opts *CheckoutOptions) error
- func (r *Repository) Revert(commit *Commit, revertOptions *RevertOptions) error
- func (r *Repository) RevertCommit(revertCommit *Commit, ourCommit *Commit, mainline uint, ...) (*Index, error)
- func (r *Repository) Revparse(spec string) (*Revspec, error)
- func (r *Repository) RevparseExt(spec string) (*Object, *Reference, error)
- func (v *Repository) RevparseSingle(spec string) (*Object, error)
- func (v *Repository) SetConfig(c *Config) error
- func (v *Repository) SetHead(refname string) error
- func (v *Repository) SetHeadDetached(id *Oid) error
- func (v *Repository) SetRefdb(refdb *Refdb)
- func (repo *Repository) SetWorkdir(workdir string, updateGitlink bool) error
- func (r *Repository) State() RepositoryState
- func (r *Repository) StateCleanup() error
- func (v *Repository) StatusFile(path string) (Status, error)
- func (v *Repository) StatusList(opts *StatusOptions) (*StatusList, error)
- func (v *Repository) TreeBuilder() (*TreeBuilder, error)
- func (v *Repository) TreeBuilderFromTree(tree *Tree) (*TreeBuilder, error)
- func (repo *Repository) UpstreamName(canonicalBranchName string) (string, error)
- func (v *Repository) Walk() (*RevWalk, error)
- func (repo *Repository) Workdir() string
- type RepositoryItem
- type RepositoryOpenFlag
- type RepositoryState
- type ResetType
- type RevWalk
- func (v *RevWalk) Free()
- func (v *RevWalk) Hide(id *Oid) error
- func (v *RevWalk) HideGlob(glob string) error
- func (v *RevWalk) HideHead() (err error)
- func (v *RevWalk) HideRef(r string) error
- func (v *RevWalk) Iterate(fun RevWalkIterator) (err error)
- func (v *RevWalk) Next(id *Oid) (err error)
- func (v *RevWalk) Push(id *Oid) error
- func (v *RevWalk) PushGlob(glob string) error
- func (v *RevWalk) PushHead() (err error)
- func (v *RevWalk) PushRange(r string) error
- func (v *RevWalk) PushRef(r string) error
- func (v *RevWalk) Reset()
- func (v *RevWalk) SimplifyFirstParent()
- func (v *RevWalk) Sorting(sm SortType)
- type RevWalkIterator
- type RevertOptions
- type RevparseFlag
- type Revspec
- type Signature
- type SmartServiceAction
- type SmartSubtransport
- type SmartSubtransportCallback
- type SmartSubtransportStream
- type SortType
- type StashApplyFlag
- type StashApplyOptions
- type StashApplyProgress
- type StashApplyProgressCallback
- type StashCallback
- type StashCollection
- func (c *StashCollection) Apply(index int, opts StashApplyOptions) error
- func (c *StashCollection) Drop(index int) error
- func (c *StashCollection) Foreach(callback StashCallback) error
- func (c *StashCollection) Pop(index int, opts StashApplyOptions) error
- func (c *StashCollection) Save(stasher *Signature, message string, flags StashFlag) (*Oid, error)
- type StashFlag
- type Status
- type StatusEntry
- type StatusList
- type StatusOpt
- type StatusOptions
- type StatusShow
- type Submodule
- func (sub *Submodule) AddToIndex(write_index bool) error
- func (sub *Submodule) FetchRecurseSubmodules() SubmoduleRecurse
- func (sub *Submodule) FinalizeAdd() error
- func (sub *Submodule) Free()
- func (sub *Submodule) HeadId() *Oid
- func (sub *Submodule) Ignore() SubmoduleIgnore
- func (sub *Submodule) IndexId() *Oid
- func (sub *Submodule) Init(overwrite bool) error
- func (sub *Submodule) Name() string
- func (sub *Submodule) Open() (*Repository, error)
- func (sub *Submodule) Path() string
- func (sub *Submodule) Sync() error
- func (sub *Submodule) Update(init bool, opts *SubmoduleUpdateOptions) error
- func (sub *Submodule) UpdateStrategy() SubmoduleUpdate
- func (sub *Submodule) Url() string
- func (sub *Submodule) WdId() *Oid
- type SubmoduleCallback
- type SubmoduleCbkdeprecated
- type SubmoduleCollection
- func (c *SubmoduleCollection) Add(url, path string, use_git_link bool) (*Submodule, error)
- func (c *SubmoduleCollection) Foreach(callback SubmoduleCallback) error
- func (c *SubmoduleCollection) Lookup(name string) (*Submodule, error)
- func (c *SubmoduleCollection) SetFetchRecurseSubmodules(submodule string, recurse SubmoduleRecurse) error
- func (c *SubmoduleCollection) SetIgnore(submodule string, ignore SubmoduleIgnore) error
- func (c *SubmoduleCollection) SetUpdate(submodule string, update SubmoduleUpdate) error
- func (c *SubmoduleCollection) SetUrl(submodule, url string) error
- type SubmoduleIgnore
- type SubmoduleRecurse
- type SubmoduleStatus
- type SubmoduleUpdate
- type SubmoduleUpdateOptions
- type Tag
- type TagForeachCallback
- type TagsCollection
- func (c *TagsCollection) Create(name string, obj Objecter, tagger *Signature, message string) (*Oid, error)
- func (c *TagsCollection) CreateLightweight(name string, obj Objecter, force bool) (*Oid, error)
- func (c *TagsCollection) Foreach(callback TagForeachCallback) error
- func (c *TagsCollection) List() ([]string, error)
- func (c *TagsCollection) ListWithMatch(pattern string) ([]string, error)
- func (c *TagsCollection) Remove(name string) error
- type Trailer
- type TransferProgress
- type TransferProgressCallback
- type Transport
- type TransportMessageCallback
- type Tree
- func (t *Tree) AsObject() *Object
- func (t *Tree) EntryById(id *Oid) *TreeEntry
- func (t *Tree) EntryByIndex(index uint64) *TreeEntry
- func (t *Tree) EntryByName(filename string) *TreeEntry
- func (t *Tree) EntryByPath(path string) (*TreeEntry, error)
- func (t *Tree) EntryCount() uint64
- func (t *Tree) Walk(callback TreeWalkCallback) error
- type TreeBuilder
- type TreeEntry
- type TreeWalkCallback
- type UpdateTipsCallback
Constants ¶
const ( CheckoutNotifyNone CheckoutNotifyType = C.GIT_CHECKOUT_NOTIFY_NONE CheckoutNotifyConflict CheckoutNotifyType = C.GIT_CHECKOUT_NOTIFY_CONFLICT CheckoutNotifyDirty CheckoutNotifyType = C.GIT_CHECKOUT_NOTIFY_DIRTY CheckoutNotifyUpdated CheckoutNotifyType = C.GIT_CHECKOUT_NOTIFY_UPDATED CheckoutNotifyUntracked CheckoutNotifyType = C.GIT_CHECKOUT_NOTIFY_UNTRACKED CheckoutNotifyIgnored CheckoutNotifyType = C.GIT_CHECKOUT_NOTIFY_IGNORED CheckoutNotifyAll CheckoutNotifyType = C.GIT_CHECKOUT_NOTIFY_ALL CheckoutNone CheckoutStrategy = C.GIT_CHECKOUT_NONE // Dry run, no actual updates CheckoutSafe CheckoutStrategy = C.GIT_CHECKOUT_SAFE // Allow safe updates that cannot overwrite uncommitted data CheckoutForce CheckoutStrategy = C.GIT_CHECKOUT_FORCE // Allow all updates to force working directory to look like index CheckoutRecreateMissing CheckoutStrategy = C.GIT_CHECKOUT_RECREATE_MISSING // Allow checkout to recreate missing files CheckoutAllowConflicts CheckoutStrategy = C.GIT_CHECKOUT_ALLOW_CONFLICTS // Allow checkout to make safe updates even if conflicts are found CheckoutRemoveUntracked CheckoutStrategy = C.GIT_CHECKOUT_REMOVE_UNTRACKED // Remove untracked files not in index (that are not ignored) CheckoutRemoveIgnored CheckoutStrategy = C.GIT_CHECKOUT_REMOVE_IGNORED // Remove ignored files not in index CheckoutUpdateOnly CheckoutStrategy = C.GIT_CHECKOUT_UPDATE_ONLY // Only update existing files, don't create new ones CheckoutDontUpdateIndex CheckoutStrategy = C.GIT_CHECKOUT_DONT_UPDATE_INDEX // Normally checkout updates index entries as it goes; this stops that CheckoutNoRefresh CheckoutStrategy = C.GIT_CHECKOUT_NO_REFRESH // Don't refresh index/config/etc before doing checkout CheckoutSkipUnmerged CheckoutStrategy = C.GIT_CHECKOUT_SKIP_UNMERGED // Allow checkout to skip unmerged files CheckoutUseOurs CheckoutStrategy = C.GIT_CHECKOUT_USE_OURS // For unmerged files, checkout stage 2 from index CheckoutUseTheirs CheckoutStrategy = C.GIT_CHECKOUT_USE_THEIRS // For unmerged files, checkout stage 3 from index CheckoutDisablePathspecMatch CheckoutStrategy = C.GIT_CHECKOUT_DISABLE_PATHSPEC_MATCH // Treat pathspec as simple list of exact match file paths CheckoutSkipLockedDirectories CheckoutStrategy = C.GIT_CHECKOUT_SKIP_LOCKED_DIRECTORIES // Ignore directories in use, they will be left empty CheckoutDontOverwriteIgnored CheckoutStrategy = C.GIT_CHECKOUT_DONT_OVERWRITE_IGNORED // Don't overwrite ignored files that exist in the checkout target CheckoutConflictStyleMerge CheckoutStrategy = C.GIT_CHECKOUT_CONFLICT_STYLE_MERGE // Write normal merge files for conflicts CheckoutConflictStyleDiff3 CheckoutStrategy = C.GIT_CHECKOUT_CONFLICT_STYLE_DIFF3 // Include common ancestor data in diff3 format files for conflicts CheckoutDontRemoveExisting CheckoutStrategy = C.GIT_CHECKOUT_DONT_REMOVE_EXISTING // Don't overwrite existing files or folders CheckoutDontWriteIndex CheckoutStrategy = C.GIT_CHECKOUT_DONT_WRITE_INDEX // Normally checkout writes the index upon completion; this prevents that CheckoutUpdateSubmodules CheckoutStrategy = C.GIT_CHECKOUT_UPDATE_SUBMODULES // Recursively checkout submodules with same options (NOT IMPLEMENTED) CheckoutUpdateSubmodulesIfChanged CheckoutStrategy = C.GIT_CHECKOUT_UPDATE_SUBMODULES_IF_CHANGED // Recursively checkout submodules if HEAD moved in super repo (NOT IMPLEMENTED) )
const ( CredTypeUserpassPlaintext = CredentialTypeUserpassPlaintext CredTypeSshKey = CredentialTypeSSHKey CredTypeSshCustom = CredentialTypeSSHCustom CredTypeDefault = CredentialTypeDefault )
const ( // Deprecated: FeatureHttps is a deprecated alias of FeatureHTTPS. FeatureHttps = FeatureHTTPS // Deprecated: FeatureSsh is a deprecated alias of FeatureSSH. FeatureSsh = FeatureSSH )
const ( // Deprecated: ErrClassNone is a deprecated alias of ErrorClassNone. ErrClassNone = ErrorClassNone // Deprecated: ErrClassNoMemory is a deprecated alias of ErrorClassNoMemory. ErrClassNoMemory = ErrorClassNoMemory // Deprecated: ErrClassOs is a deprecated alias of ErrorClassOS. ErrClassOs = ErrorClassOS // Deprecated: ErrClassInvalid is a deprecated alias of ErrorClassInvalid. ErrClassInvalid = ErrorClassInvalid // Deprecated: ErrClassReference is a deprecated alias of ErrorClassReference. ErrClassReference = ErrorClassReference // Deprecated: ErrClassZlib is a deprecated alias of ErrorClassZlib. ErrClassZlib = ErrorClassZlib // Deprecated: ErrClassRepository is a deprecated alias of ErrorClassRepository. ErrClassRepository = ErrorClassRepository // Deprecated: ErrClassConfig is a deprecated alias of ErrorClassConfig. ErrClassConfig = ErrorClassConfig // Deprecated: ErrClassRegex is a deprecated alias of ErrorClassRegex. ErrClassRegex = ErrorClassRegex // Deprecated: ErrClassOdb is a deprecated alias of ErrorClassOdb. ErrClassOdb = ErrorClassOdb // Deprecated: ErrClassIndex is a deprecated alias of ErrorClassIndex. ErrClassIndex = ErrorClassIndex // Deprecated: ErrClassObject is a deprecated alias of ErrorClassObject. ErrClassObject = ErrorClassObject // Deprecated: ErrClassNet is a deprecated alias of ErrorClassNet. ErrClassNet = ErrorClassNet // Deprecated: ErrClassTag is a deprecated alias of ErrorClassTag. ErrClassTag = ErrorClassTag // Deprecated: ErrClassTree is a deprecated alias of ErrorClassTree. ErrClassTree = ErrorClassTree // Deprecated: ErrClassIndexer is a deprecated alias of ErrorClassIndexer. ErrClassIndexer = ErrorClassIndexer // Deprecated: ErrClassSSL is a deprecated alias of ErrorClassSSL. ErrClassSSL = ErrorClassSSL // Deprecated: ErrClassSubmodule is a deprecated alias of ErrorClassSubmodule. ErrClassSubmodule = ErrorClassSubmodule // Deprecated: ErrClassThread is a deprecated alias of ErrorClassThread. ErrClassThread = ErrorClassThread // Deprecated: ErrClassStash is a deprecated alias of ErrorClassStash. ErrClassStash = ErrorClassStash // Deprecated: ErrClassCheckout is a deprecated alias of ErrorClassCheckout. ErrClassCheckout = ErrorClassCheckout // Deprecated: ErrClassFetchHead is a deprecated alias of ErrorClassFetchHead. ErrClassFetchHead = ErrorClassFetchHead // Deprecated: ErrClassMerge is a deprecated alias of ErrorClassMerge. ErrClassMerge = ErrorClassMerge // Deprecated: ErrClassSsh is a deprecated alias of ErrorClassSSH. ErrClassSsh = ErrorClassSSH // Deprecated: ErrClassFilter is a deprecated alias of ErrorClassFilter. ErrClassFilter = ErrorClassFilter // Deprecated: ErrClassRevert is a deprecated alias of ErrorClassRevert. ErrClassRevert = ErrorClassRevert // Deprecated: ErrClassCallback is a deprecated alias of ErrorClassCallback. ErrClassCallback = ErrorClassCallback // Deprecated: ErrClassRebase is a deprecated alias of ErrorClassRebase. ErrClassRebase = ErrorClassRebase // Deprecated: ErrClassPatch is a deprecated alias of ErrorClassPatch. ErrClassPatch = ErrorClassPatch )
const ( // Deprecated: ErrOk is a deprecated alias of ErrorCodeOK. ErrOk = ErrorCodeOK // Deprecated: ErrGeneric is a deprecated alias of ErrorCodeGeneric. ErrGeneric = ErrorCodeGeneric // Deprecated: ErrNotFound is a deprecated alias of ErrorCodeNotFound. ErrNotFound = ErrorCodeNotFound // Deprecated: ErrExists is a deprecated alias of ErrorCodeExists. ErrExists = ErrorCodeExists // Deprecated: ErrAmbiguous is a deprecated alias of ErrorCodeAmbiguous. ErrAmbiguous = ErrorCodeAmbiguous // Deprecated: ErrAmbigious is a deprecated alias of ErrorCodeAmbiguous. ErrAmbigious = ErrorCodeAmbiguous // Deprecated: ErrBuffs is a deprecated alias of ErrorCodeBuffs. ErrBuffs = ErrorCodeBuffs // Deprecated: ErrUser is a deprecated alias of ErrorCodeUser. ErrUser = ErrorCodeUser // Deprecated: ErrBareRepo is a deprecated alias of ErrorCodeBareRepo. ErrBareRepo = ErrorCodeBareRepo // Deprecated: ErrUnbornBranch is a deprecated alias of ErrorCodeUnbornBranch. ErrUnbornBranch = ErrorCodeUnbornBranch // Deprecated: ErrUnmerged is a deprecated alias of ErrorCodeUnmerged. ErrUnmerged = ErrorCodeUnmerged // Deprecated: ErrNonFastForward is a deprecated alias of ErrorCodeNonFastForward. ErrNonFastForward = ErrorCodeNonFastForward // Deprecated: ErrInvalidSpec is a deprecated alias of ErrorCodeInvalidSpec. ErrInvalidSpec = ErrorCodeInvalidSpec // Deprecated: ErrConflict is a deprecated alias of ErrorCodeConflict. ErrConflict = ErrorCodeConflict // Deprecated: ErrLocked is a deprecated alias of ErrorCodeLocked. ErrLocked = ErrorCodeLocked // Deprecated: ErrModified is a deprecated alias of ErrorCodeModified. ErrModified = ErrorCodeModified // Deprecated: ErrAuth is a deprecated alias of ErrorCodeAuth. ErrAuth = ErrorCodeAuth // Deprecated: ErrCertificate is a deprecated alias of ErrorCodeCertificate. ErrCertificate = ErrorCodeCertificate // Deprecated: ErrApplied is a deprecated alias of ErrorCodeApplied. ErrApplied = ErrorCodeApplied // Deprecated: ErrPeel is a deprecated alias of ErrorCodePeel. ErrPeel = ErrorCodePeel // Deprecated: ErrEOF is a deprecated alias of ErrorCodeEOF. ErrEOF = ErrorCodeEOF // Deprecated: ErrUncommitted is a deprecated alias of ErrorCodeUncommitted. ErrUncommitted = ErrorCodeUncommitted // Deprecated: ErrDirectory is a deprecated alias of ErrorCodeDirectory. ErrDirectory = ErrorCodeDirectory // Deprecated: ErrMergeConflict is a deprecated alias of ErrorCodeMergeConflict. ErrMergeConflict = ErrorCodeMergeConflict // Deprecated: ErrPassthrough is a deprecated alias of ErrorCodePassthrough. ErrPassthrough = ErrorCodePassthrough // Deprecated: ErrIterOver is a deprecated alias of ErrorCodeIterOver. ErrIterOver = ErrorCodeIterOver // Deprecated: ErrApplyFail is a deprecated alias of ErrorCodeApplyFail. ErrApplyFail = ErrorCodeApplyFail )
const ( RemoteCompletionDownload RemoteCompletion = C.GIT_REMOTE_COMPLETION_DOWNLOAD RemoteCompletionIndexing RemoteCompletion = C.GIT_REMOTE_COMPLETION_INDEXING RemoteCompletionError RemoteCompletion = C.GIT_REMOTE_COMPLETION_ERROR ConnectDirectionFetch ConnectDirection = C.GIT_DIRECTION_FETCH ConnectDirectionPush ConnectDirection = C.GIT_DIRECTION_PUSH )
const ( // Deprecated: DiffIgnoreWhitespaceEol is a deprecated alias of DiffIgnoreWhitespaceEOL. DiffIgnoreWitespaceEol = DiffIgnoreWhitespaceEOL )
Variables ¶
var (
ErrDeltaSkip = errors.New("Skip delta")
)
var (
ErrInvalid = errors.New("Invalid state for operation")
)
var ErrRebaseNoOperation = errors.New("no current rebase operation")
Error returned if there is no current rebase operation
var RebaseNoOperation uint = ^uint(0)
Special value indicating that there is no currently active operation
Functions ¶
func CachedMemory ¶ added in v30.0.3
func CallbackGitTreeWalk
deprecated
func ConfigFindGlobal ¶
func ConfigFindProgramdata ¶
ConfigFindProgramdata locate the path to the configuration file in ProgramData.
Look for the file in %PROGRAMDATA%\Git\config used by portable git.
func ConfigFindSystem ¶
func ConfigFindXDG ¶
func DiffBlobs ¶
func DiffBlobs(oldBlob *Blob, oldAsPath string, newBlob *Blob, newAsPath string, opts *DiffOptions, fileCallback DiffForEachFileCallback, detail DiffDetail) error
DiffBlobs performs a diff between two arbitrary blobs. You can pass whatever file names you'd like for them to appear as in the diff.
func EnableCaching ¶ added in v30.0.2
func EnableFsyncGitDir ¶ added in v30.6.5
func EnableStrictHashVerification ¶ added in v30.1.0
func GetCachedMemory ¶ added in v30.0.2
deprecated: You should use `CachedMemory()` instead.
func IsErrorClass ¶
func IsErrorClass(err error, c ErrorClass) bool
func IsErrorCode ¶
func MakeGitError ¶
func MakeGitError2 ¶
func MwindowMappedLimit ¶
func MwindowSize ¶
func ReInit ¶ added in v30.0.11
func ReInit()
ReInit reinitializes the global state, this is useful if the effective user id has changed and you want to update the stored search paths for gitconfig files. This function frees any references to objects, so it should be called before any other functions are called.
func ReferenceIsValidName ¶
ReferenceIsValidName returns whether the reference name is well-formed.
Valid reference names must follow one of two patterns:
1. Top-level names must contain only capital letters and underscores, and must begin and end with a letter. (e.g. "HEAD", "ORIG_HEAD").
2. Names prefixed with "refs/" can be almost anything. You must avoid the characters '~', '^', ':', ' \ ', '?', '[', and '*', and the sequences ".." and " @ {" which have special meaning to revparse.
func ReferenceNormalizeName ¶ added in v30.2.2
func ReferenceNormalizeName(name string, flags ReferenceFormat) (string, error)
ReferenceNormalizeName normalizes the reference name and checks validity.
This will normalize the reference name by removing any leading slash '/' characters and collapsing runs of adjacent slashes between name components into a single slash.
See git_reference_symbolic_create() for rules about valid names.
func RemoteIsValidName ¶
RemoteIsValidName returns whether the remote name is well-formed.
func SearchPath ¶
func SearchPath(level ConfigLevel) (string, error)
func SetCacheMaxSize ¶ added in v30.0.2
func SetCacheObjectLimit ¶ added in v30.0.2
func SetCacheObjectLimit(objectType ObjectType, size int) error
func SetMwindowMappedLimit ¶
func SetMwindowSize ¶
func SetSearchPath ¶
func SetSearchPath(level ConfigLevel, path string) error
func Shutdown ¶ added in v30.0.5
func Shutdown()
Shutdown frees all the resources acquired by libgit2. Make sure no references to any git2go objects are live before calling this. After this is called, invoking any function from this library will result in undefined behavior, so make sure this is called carefully.
Types ¶
type AnnotatedCommit ¶
type AnnotatedCommit struct {
// contains filtered or unexported fields
}
func (*AnnotatedCommit) Free ¶
func (mh *AnnotatedCommit) Free()
func (*AnnotatedCommit) Id ¶
func (mh *AnnotatedCommit) Id() *Oid
type ApplyDeltaCallback ¶ added in v30.0.8
ApplyDeltaCallback is a callback that will be made per hunk when applying a patch.
type ApplyHunkCallback ¶ added in v30.0.8
ApplyHunkCallback is a callback that will be made per delta (file) when applying a patch.
type ApplyLocation ¶ added in v30.0.8
type ApplyLocation int
ApplyLocation represents the possible application locations for applying diffs.
const ( // ApplyLocationWorkdir applies the patch to the workdir, leaving the // index untouched. This is the equivalent of `git apply` with no location // argument. ApplyLocationWorkdir ApplyLocation = C.GIT_APPLY_LOCATION_WORKDIR // ApplyLocationIndex applies the patch to the index, leaving the working // directory untouched. This is the equivalent of `git apply --cached`. ApplyLocationIndex ApplyLocation = C.GIT_APPLY_LOCATION_INDEX // ApplyLocationBoth applies the patch to both the working directory and // the index. This is the equivalent of `git apply --index`. ApplyLocationBoth ApplyLocation = C.GIT_APPLY_LOCATION_BOTH )
type ApplyOptions ¶ added in v30.0.8
type ApplyOptions struct { ApplyHunkCallback ApplyHunkCallback ApplyDeltaCallback ApplyDeltaCallback Flags uint }
ApplyOptions has 2 callbacks that are called for hunks or deltas If these functions return an error, abort the apply process immediately. If the first return value is true, the delta/hunk will be applied. If it is false, the delta/hunk will not be applied. In either case, the rest of the apply process will continue.
func DefaultApplyOptions ¶ added in v30.0.8
func DefaultApplyOptions() (*ApplyOptions, error)
DefaultApplyOptions returns default options for applying diffs or patches.
type BlameOptions ¶
type BlameOptions struct { Flags BlameOptionsFlag MinMatchCharacters uint16 NewestCommit *Oid OldestCommit *Oid MinLine uint32 MaxLine uint32 }
func DefaultBlameOptions ¶
func DefaultBlameOptions() (BlameOptions, error)
type BlameOptionsFlag ¶
type BlameOptionsFlag uint32
const ( BlameNormal BlameOptionsFlag = C.GIT_BLAME_NORMAL BlameTrackCopiesSameFile BlameOptionsFlag = C.GIT_BLAME_TRACK_COPIES_SAME_FILE BlameTrackCopiesSameCommitMoves BlameOptionsFlag = C.GIT_BLAME_TRACK_COPIES_SAME_COMMIT_MOVES BlameTrackCopiesSameCommitCopies BlameOptionsFlag = C.GIT_BLAME_TRACK_COPIES_SAME_COMMIT_COPIES BlameTrackCopiesAnyCommitCopies BlameOptionsFlag = C.GIT_BLAME_TRACK_COPIES_ANY_COMMIT_COPIES BlameFirstParent BlameOptionsFlag = C.GIT_BLAME_FIRST_PARENT BlameUseMailmap BlameOptionsFlag = C.GIT_BLAME_USE_MAILMAP )
type BlobCallbackData
deprecated
type BlobCallbackData struct { Callback BlobChunkCallback Error error }
Deprecated: BlobCallbackData is not used.
type BlobChunkCallback
deprecated
type BlobWriteStream ¶
type BlobWriteStream struct {
// contains filtered or unexported fields
}
func (*BlobWriteStream) Commit ¶
func (stream *BlobWriteStream) Commit() (*Oid, error)
func (*BlobWriteStream) Free ¶
func (stream *BlobWriteStream) Free()
type Branch ¶
type Branch struct { *Reference // contains filtered or unexported fields }
func (*Branch) SetUpstream ¶
type BranchIterator ¶
type BranchIterator struct {
// contains filtered or unexported fields
}
func (*BranchIterator) ForEach ¶
func (i *BranchIterator) ForEach(f BranchIteratorFunc) error
func (*BranchIterator) Free ¶
func (i *BranchIterator) Free()
func (*BranchIterator) Next ¶
func (i *BranchIterator) Next() (*Branch, BranchType, error)
type BranchIteratorFunc ¶
type BranchIteratorFunc func(*Branch, BranchType) error
type BranchType ¶
type BranchType uint
const ( BranchAll BranchType = C.GIT_BRANCH_ALL BranchLocal BranchType = C.GIT_BRANCH_LOCAL BranchRemote BranchType = C.GIT_BRANCH_REMOTE )
type Certificate ¶
type Certificate struct { Kind CertificateKind X509 *x509.Certificate Hostkey HostkeyCertificate }
Certificate represents the two possible certificates which libgit2 knows it might find. If Kind is CertficateX509 then the X509 field will be filled. If Kind is CertificateHostkey then the Hostkey field will be fille.d
type CertificateCheckCallback ¶
type CertificateCheckCallback func(cert *Certificate, valid bool, hostname string) ErrorCode
type CertificateKind ¶
type CertificateKind uint
const ( CertificateX509 CertificateKind = C.GIT_CERT_X509 CertificateHostkey CertificateKind = C.GIT_CERT_HOSTKEY_LIBSSH2 )
type CheckoutNotifyCallback ¶
type CheckoutNotifyCallback func(why CheckoutNotifyType, path string, baseline, target, workdir DiffFile) ErrorCode
type CheckoutNotifyType ¶
type CheckoutNotifyType uint
type CheckoutOptions ¶ added in v30.3.0
type CheckoutOptions 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 NotifyFlags CheckoutNotifyType // Default will be none NotifyCallback CheckoutNotifyCallback ProgressCallback CheckoutProgressCallback TargetDirectory string // Alternative checkout path to workdir Paths []string Baseline *Tree }
type CheckoutOpts
deprecated
type CheckoutOpts = CheckoutOptions
Deprecated: CheckoutOpts is a deprecated alias of CheckoutOptions.
type CheckoutStrategy ¶
type CheckoutStrategy uint
type CherrypickOptions ¶
type CherrypickOptions struct { Version uint Mainline uint MergeOpts MergeOptions CheckoutOpts CheckoutOptions }
func DefaultCherrypickOptions ¶
func DefaultCherrypickOptions() (CherrypickOptions, error)
type CloneOptions ¶
type CloneOptions struct { *CheckoutOpts *FetchOptions Bare bool CheckoutBranch string RemoteCreateCallback RemoteCreateCallback }
type Commit ¶
type Commit struct { Object // contains filtered or unexported fields }
Commit
func (*Commit) ContentToSign ¶ added in v30.0.9
ContentToSign returns the content that will be passed to a signing function for this commit
func (*Commit) Describe ¶
func (c *Commit) Describe(opts *DescribeOptions) (*DescribeResult, error)
Describe performs the describe operation on the commit.
func (*Commit) MessageEncoding ¶
func (*Commit) ParentCount ¶
func (*Commit) RawMessage ¶
func (*Commit) WithSignature ¶ added in v30.0.9
WithSignature creates a new signed commit from the given signature and signature field
func (*Commit) WithSignatureUsing ¶ added in v30.0.9
func (c *Commit) WithSignatureUsing(f CommitSigningCallback) (*Oid, error)
WithSignatureUsing creates a new signed commit from this one using the given signing callback
type CommitSigningCallback ¶ added in v30.0.9
CommitSigningCallback defines a function type that takes some data to sign and returns (signature, signature_field, error)
type CompletionCallback ¶
type CompletionCallback func(RemoteCompletion) ErrorCode
type Config ¶
type Config struct {
// contains filtered or unexported fields
}
func OpenDefault ¶ added in v30.3.14
OpenDefault opens the default config according to git rules
func OpenOndisk ¶
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) 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) SetMultivar ¶
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 on Windows, for compatibility with portable git ConfigLevelProgramdata ConfigLevel = C.GIT_CONFIG_LEVEL_PROGRAMDATA // 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 ConnectDirection ¶
type ConnectDirection uint
type Cred
deprecated
type Cred = Credential
Deprecated: Cred is a deprecated alias of Credential
func NewCredDefault
deprecated
func NewCredSshKeyFromAgent
deprecated
func NewCredUsername
deprecated
added in
v30.3.0
func NewCredUserpassPlaintext
deprecated
type CredType
deprecated
type CredType = CredentialType
Deprecated: CredType is a deprecated alias of CredentialType
type Credential ¶ added in v30.3.0
type Credential struct {
// contains filtered or unexported fields
}
func NewCredentialDefault ¶ added in v30.3.0
func NewCredentialDefault() (*Credential, error)
func NewCredentialSSHKey ¶ added in v30.3.0
func NewCredentialSSHKey(username string, publicKeyPath string, privateKeyPath string, passphrase string) (*Credential, error)
NewCredentialSSHKey creates new ssh credentials reading the public and private keys from the file system.
func NewCredentialSSHKeyFromAgent ¶ added in v30.3.0
func NewCredentialSSHKeyFromAgent(username string) (*Credential, error)
func NewCredentialSSHKeyFromMemory ¶ added in v30.3.0
func NewCredentialSSHKeyFromMemory(username string, publicKey string, privateKey string, passphrase string) (*Credential, error)
NewCredentialSSHKeyFromMemory creates new ssh credentials using the publicKey and privateKey arguments as the values for the public and private keys.
func NewCredentialSSHKeyFromSigner ¶ added in v30.3.2
func NewCredentialSSHKeyFromSigner(username string, signer ssh.Signer) (*Credential, error)
NewCredentialSSHKeyFromSigner creates new SSH credentials using the provided signer.
func NewCredentialUsername ¶ added in v30.3.0
func NewCredentialUsername(username string) (*Credential, error)
func NewCredentialUserpassPlaintext ¶ added in v30.3.0
func NewCredentialUserpassPlaintext(username string, password string) (*Credential, error)
func (*Credential) Free ¶ added in v30.3.0
func (o *Credential) Free()
func (*Credential) GetSSHKey ¶ added in v30.5.0
func (o *Credential) GetSSHKey() (username, publickey, privatekey, passphrase string, err error)
GetSSHKey returns the SSH-specific key information from the Cred object.
func (*Credential) GetUserpassPlaintext ¶ added in v30.4.3
func (o *Credential) GetUserpassPlaintext() (username, password string, err error)
GetUserpassPlaintext returns the plaintext username/password combination stored in the Cred.
func (*Credential) HasUsername ¶ added in v30.3.0
func (o *Credential) HasUsername() bool
func (*Credential) Type ¶ added in v30.3.0
func (o *Credential) Type() CredentialType
type CredentialType ¶ added in v30.3.0
type CredentialType uint
CredentialType is a bitmask of supported credential types.
This represents the various types of authentication methods supported by the library.
const ( CredentialTypeUserpassPlaintext CredentialType = C.GIT_CREDENTIAL_USERPASS_PLAINTEXT CredentialTypeSSHKey CredentialType = C.GIT_CREDENTIAL_SSH_KEY CredentialTypeSSHCustom CredentialType = C.GIT_CREDENTIAL_SSH_CUSTOM CredentialTypeDefault CredentialType = C.GIT_CREDENTIAL_DEFAULT CredentialTypeSSHInteractive CredentialType = C.GIT_CREDENTIAL_SSH_INTERACTIVE CredentialTypeUsername CredentialType = C.GIT_CREDENTIAL_USERNAME CredentialTypeSSHMemory CredentialType = C.GIT_CREDENTIAL_SSH_MEMORY )
func (CredentialType) String ¶ added in v30.3.0
func (t CredentialType) String() string
type CredentialsCallback ¶
type CredentialsCallback func(url string, username_from_url string, allowed_types CredentialType) (*Credential, error)
type Delta ¶
type Delta int
const ( DeltaUnmodified Delta = C.GIT_DELTA_UNMODIFIED DeltaAdded Delta = C.GIT_DELTA_ADDED DeltaDeleted Delta = C.GIT_DELTA_DELETED DeltaModified Delta = C.GIT_DELTA_MODIFIED DeltaRenamed Delta = C.GIT_DELTA_RENAMED DeltaCopied Delta = C.GIT_DELTA_COPIED DeltaIgnored Delta = C.GIT_DELTA_IGNORED DeltaUntracked Delta = C.GIT_DELTA_UNTRACKED DeltaTypeChange Delta = C.GIT_DELTA_TYPECHANGE DeltaUnreadable Delta = C.GIT_DELTA_UNREADABLE DeltaConflicted Delta = C.GIT_DELTA_CONFLICTED )
type DescribeFormatOptions ¶
type DescribeFormatOptions struct { // Size of the abbreviated commit id to use. This value is the // lower bound for the length of the abbreviated string. AbbreviatedSize uint // default: 7 // Set to use the long format even when a shorter name could be used. AlwaysUseLongFormat bool // If the workdir is dirty and this is set, this string will be // appended to the description string. DirtySuffix string }
DescribeFormatOptions can be used for formatting the describe string.
You can use DefaultDescribeFormatOptions() to get default options.
func DefaultDescribeFormatOptions ¶
func DefaultDescribeFormatOptions() (DescribeFormatOptions, error)
DefaultDescribeFormatOptions returns default options for formatting the output.
type DescribeOptions ¶
type DescribeOptions struct { // How many tags as candidates to consider to describe the input commit-ish. // Increasing it above 10 will take slightly longer but may produce a more // accurate result. 0 will cause only exact matches to be output. MaxCandidatesTags uint // default: 10 // By default describe only shows annotated tags. Change this in order // to show all refs from refs/tags or refs/. Strategy DescribeOptionsStrategy // default: DescribeDefault // Only consider tags matching the given glob(7) pattern, excluding // the "refs/tags/" prefix. Can be used to avoid leaking private // tags from the repo. Pattern string // When calculating the distance from the matching tag or // reference, only walk down the first-parent ancestry. OnlyFollowFirstParent bool // If no matching tag or reference is found, the describe // operation would normally fail. If this option is set, it // will instead fall back to showing the full id of the commit. ShowCommitOidAsFallback bool }
DescribeOptions represents the describe operation configuration.
You can use DefaultDescribeOptions() to get default options.
func DefaultDescribeOptions ¶
func DefaultDescribeOptions() (DescribeOptions, error)
DefaultDescribeOptions returns default options for the describe operation.
type DescribeOptionsStrategy ¶
type DescribeOptionsStrategy uint
DescribeOptionsStrategy behaves like the --tags and --all options to git-describe, namely they say to look for any reference in either refs/tags/ or refs/ respectively.
By default it only shows annotated tags.
const ( DescribeDefault DescribeOptionsStrategy = C.GIT_DESCRIBE_DEFAULT DescribeTags DescribeOptionsStrategy = C.GIT_DESCRIBE_TAGS DescribeAll DescribeOptionsStrategy = C.GIT_DESCRIBE_ALL )
Describe strategy options.
type DescribeResult ¶
type DescribeResult struct {
// contains filtered or unexported fields
}
DescribeResult represents the output from the 'git_describe_commit' and 'git_describe_workdir' functions in libgit2.
Use Format() to get a string out of it.
func (*DescribeResult) Format ¶
func (result *DescribeResult) Format(opts *DescribeFormatOptions) (string, error)
Format prints the DescribeResult as a string.
type Diff ¶
type Diff struct {
// contains filtered or unexported fields
}
func DiffFromBuffer ¶ added in v30.0.8
func DiffFromBuffer(buffer []byte, repo *Repository) (*Diff, error)
DiffFromBuffer reads the contents of a git patch file into a Diff object.
The diff object produced is similar to the one that would be produced if you actually produced it computationally by comparing two trees, however there may be subtle differences. For example, a patch file likely contains abbreviated object IDs, so the object IDs in a git_diff_delta produced by this function will also be abbreviated.
This function will only read patch files created by a git implementation, it will not read unified diffs produced by the diff program, nor any other types of patch files.
func (*Diff) FindSimilar ¶
func (diff *Diff) FindSimilar(opts *DiffFindOptions) error
func (*Diff) ForEach ¶
func (diff *Diff) ForEach(cbFile DiffForEachFileCallback, detail DiffDetail) error
type DiffDetail ¶
type DiffDetail int
const ( DiffDetailFiles DiffDetail = iota DiffDetailHunks DiffDetailLines )
type DiffFindOptions ¶
type DiffFindOptions struct { Flags DiffFindOptionsFlag RenameThreshold uint16 CopyThreshold uint16 RenameFromRewriteThreshold uint16 BreakRewriteThreshold uint16 RenameLimit uint }
TODO implement git_diff_similarity_metric
func DefaultDiffFindOptions ¶
func DefaultDiffFindOptions() (DiffFindOptions, error)
type DiffFindOptionsFlag ¶
type DiffFindOptionsFlag int
const ( DiffFindByConfig DiffFindOptionsFlag = C.GIT_DIFF_FIND_BY_CONFIG DiffFindRenames DiffFindOptionsFlag = C.GIT_DIFF_FIND_RENAMES DiffFindRenamesFromRewrites DiffFindOptionsFlag = C.GIT_DIFF_FIND_RENAMES_FROM_REWRITES DiffFindCopies DiffFindOptionsFlag = C.GIT_DIFF_FIND_COPIES DiffFindCopiesFromUnmodified DiffFindOptionsFlag = C.GIT_DIFF_FIND_COPIES_FROM_UNMODIFIED DiffFindRewrites DiffFindOptionsFlag = C.GIT_DIFF_FIND_REWRITES DiffFindBreakRewrites DiffFindOptionsFlag = C.GIT_DIFF_BREAK_REWRITES DiffFindAndBreakRewrites DiffFindOptionsFlag = C.GIT_DIFF_FIND_AND_BREAK_REWRITES DiffFindForUntracked DiffFindOptionsFlag = C.GIT_DIFF_FIND_FOR_UNTRACKED DiffFindAll DiffFindOptionsFlag = C.GIT_DIFF_FIND_ALL DiffFindIgnoreLeadingWhitespace DiffFindOptionsFlag = C.GIT_DIFF_FIND_IGNORE_LEADING_WHITESPACE DiffFindIgnoreWhitespace DiffFindOptionsFlag = C.GIT_DIFF_FIND_IGNORE_WHITESPACE DiffFindDontIgnoreWhitespace DiffFindOptionsFlag = C.GIT_DIFF_FIND_DONT_IGNORE_WHITESPACE DiffFindExactMatchOnly DiffFindOptionsFlag = C.GIT_DIFF_FIND_EXACT_MATCH_ONLY DiffFindBreakRewritesForRenamesOnly DiffFindOptionsFlag = C.GIT_DIFF_BREAK_REWRITES_FOR_RENAMES_ONLY DiffFindRemoveUnmodified DiffFindOptionsFlag = C.GIT_DIFF_FIND_REMOVE_UNMODIFIED )
type DiffFlag ¶
type DiffFlag uint32
const ( DiffFlagBinary DiffFlag = C.GIT_DIFF_FLAG_BINARY DiffFlagNotBinary DiffFlag = C.GIT_DIFF_FLAG_NOT_BINARY DiffFlagValidOid DiffFlag = C.GIT_DIFF_FLAG_VALID_ID DiffFlagExists DiffFlag = C.GIT_DIFF_FLAG_EXISTS )
type DiffForEachFileCallback ¶
type DiffForEachFileCallback func(delta DiffDelta, progress float64) (DiffForEachHunkCallback, error)
type DiffForEachHunkCallback ¶
type DiffForEachHunkCallback func(DiffHunk) (DiffForEachLineCallback, error)
type DiffForEachLineCallback ¶
type DiffFormat ¶
type DiffFormat int
const ( DiffFormatPatch DiffFormat = C.GIT_DIFF_FORMAT_PATCH DiffFormatPatchHeader DiffFormat = C.GIT_DIFF_FORMAT_PATCH_HEADER DiffFormatRaw DiffFormat = C.GIT_DIFF_FORMAT_RAW DiffFormatNameOnly DiffFormat = C.GIT_DIFF_FORMAT_NAME_ONLY DiffFormatNameStatus DiffFormat = C.GIT_DIFF_FORMAT_NAME_STATUS )
type DiffLine ¶
type DiffLine struct { Origin DiffLineType OldLineno int NewLineno int NumLines int Content string }
type DiffLineType ¶
type DiffLineType int
const ( DiffLineContext DiffLineType = C.GIT_DIFF_LINE_CONTEXT DiffLineAddition DiffLineType = C.GIT_DIFF_LINE_ADDITION DiffLineDeletion DiffLineType = C.GIT_DIFF_LINE_DELETION DiffLineContextEOFNL DiffLineType = C.GIT_DIFF_LINE_CONTEXT_EOFNL DiffLineAddEOFNL DiffLineType = C.GIT_DIFF_LINE_ADD_EOFNL DiffLineDelEOFNL DiffLineType = C.GIT_DIFF_LINE_DEL_EOFNL DiffLineFileHdr DiffLineType = C.GIT_DIFF_LINE_FILE_HDR DiffLineHunkHdr DiffLineType = C.GIT_DIFF_LINE_HUNK_HDR DiffLineBinary DiffLineType = C.GIT_DIFF_LINE_BINARY )
func (DiffLineType) String ¶
func (i DiffLineType) String() string
type DiffNotifyCallback ¶
type DiffOptions ¶
type DiffOptions struct { Flags DiffOptionsFlag IgnoreSubmodules SubmoduleIgnore Pathspec []string NotifyCallback DiffNotifyCallback ContextLines uint32 InterhunkLines uint32 IdAbbrev uint16 MaxSize int OldPrefix string NewPrefix string }
func DefaultDiffOptions ¶
func DefaultDiffOptions() (DiffOptions, error)
type DiffOptionsFlag ¶
type DiffOptionsFlag int
const ( DiffNormal DiffOptionsFlag = C.GIT_DIFF_NORMAL DiffReverse DiffOptionsFlag = C.GIT_DIFF_REVERSE DiffIncludeIgnored DiffOptionsFlag = C.GIT_DIFF_INCLUDE_IGNORED DiffRecurseIgnoredDirs DiffOptionsFlag = C.GIT_DIFF_RECURSE_IGNORED_DIRS DiffIncludeUntracked DiffOptionsFlag = C.GIT_DIFF_INCLUDE_UNTRACKED DiffRecurseUntracked DiffOptionsFlag = C.GIT_DIFF_RECURSE_UNTRACKED_DIRS DiffIncludeUnmodified DiffOptionsFlag = C.GIT_DIFF_INCLUDE_UNMODIFIED DiffIncludeTypeChange DiffOptionsFlag = C.GIT_DIFF_INCLUDE_TYPECHANGE DiffIncludeTypeChangeTrees DiffOptionsFlag = C.GIT_DIFF_INCLUDE_TYPECHANGE_TREES DiffIgnoreFilemode DiffOptionsFlag = C.GIT_DIFF_IGNORE_FILEMODE DiffIgnoreSubmodules DiffOptionsFlag = C.GIT_DIFF_IGNORE_SUBMODULES DiffIgnoreCase DiffOptionsFlag = C.GIT_DIFF_IGNORE_CASE DiffIncludeCaseChange DiffOptionsFlag = C.GIT_DIFF_INCLUDE_CASECHANGE DiffDisablePathspecMatch DiffOptionsFlag = C.GIT_DIFF_DISABLE_PATHSPEC_MATCH DiffSkipBinaryCheck DiffOptionsFlag = C.GIT_DIFF_SKIP_BINARY_CHECK DiffEnableFastUntrackedDirs DiffOptionsFlag = C.GIT_DIFF_ENABLE_FAST_UNTRACKED_DIRS DiffForceText DiffOptionsFlag = C.GIT_DIFF_FORCE_TEXT DiffForceBinary DiffOptionsFlag = C.GIT_DIFF_FORCE_BINARY DiffIgnoreWhitespace DiffOptionsFlag = C.GIT_DIFF_IGNORE_WHITESPACE DiffIgnoreWhitespaceChange DiffOptionsFlag = C.GIT_DIFF_IGNORE_WHITESPACE_CHANGE DiffIgnoreWhitespaceEOL DiffOptionsFlag = C.GIT_DIFF_IGNORE_WHITESPACE_EOL DiffShowUntrackedContent DiffOptionsFlag = C.GIT_DIFF_SHOW_UNTRACKED_CONTENT DiffShowUnmodified DiffOptionsFlag = C.GIT_DIFF_SHOW_UNMODIFIED DiffPatience DiffOptionsFlag = C.GIT_DIFF_PATIENCE DiffMinimal DiffOptionsFlag = C.GIT_DIFF_MINIMAL DiffShowBinary DiffOptionsFlag = C.GIT_DIFF_SHOW_BINARY DiffIndentHeuristic DiffOptionsFlag = C.GIT_DIFF_INDENT_HEURISTIC )
type DiffStats ¶
type DiffStats struct {
// contains filtered or unexported fields
}
func (*DiffStats) FilesChanged ¶
func (*DiffStats) Insertions ¶
type DiffStatsFormat ¶
type DiffStatsFormat int
const ( DiffStatsNone DiffStatsFormat = C.GIT_DIFF_STATS_NONE DiffStatsFull DiffStatsFormat = C.GIT_DIFF_STATS_FULL DiffStatsShort DiffStatsFormat = C.GIT_DIFF_STATS_SHORT DiffStatsNumber DiffStatsFormat = C.GIT_DIFF_STATS_NUMBER DiffStatsIncludeSummary DiffStatsFormat = C.GIT_DIFF_STATS_INCLUDE_SUMMARY )
type DownloadTags ¶
type DownloadTags uint
const ( // Use the setting from the configuration. DownloadTagsUnspecified DownloadTags = C.GIT_REMOTE_DOWNLOAD_TAGS_UNSPECIFIED // Ask the server for tags pointing to objects we're already // downloading. DownloadTagsAuto DownloadTags = C.GIT_REMOTE_DOWNLOAD_TAGS_AUTO // Don't ask for any tags beyond the refspecs. DownloadTagsNone DownloadTags = C.GIT_REMOTE_DOWNLOAD_TAGS_NONE // Ask for the all the tags. DownloadTagsAll DownloadTags = C.GIT_REMOTE_DOWNLOAD_TAGS_ALL )
type ErrorClass ¶
type ErrorClass int
const ( ErrorClassNone ErrorClass = C.GIT_ERROR_NONE ErrorClassNoMemory ErrorClass = C.GIT_ERROR_NOMEMORY ErrorClassOS ErrorClass = C.GIT_ERROR_OS ErrorClassInvalid ErrorClass = C.GIT_ERROR_INVALID ErrorClassReference ErrorClass = C.GIT_ERROR_REFERENCE ErrorClassZlib ErrorClass = C.GIT_ERROR_ZLIB ErrorClassRepository ErrorClass = C.GIT_ERROR_REPOSITORY ErrorClassConfig ErrorClass = C.GIT_ERROR_CONFIG ErrorClassRegex ErrorClass = C.GIT_ERROR_REGEX ErrorClassOdb ErrorClass = C.GIT_ERROR_ODB ErrorClassIndex ErrorClass = C.GIT_ERROR_INDEX ErrorClassObject ErrorClass = C.GIT_ERROR_OBJECT ErrorClassNet ErrorClass = C.GIT_ERROR_NET ErrorClassTag ErrorClass = C.GIT_ERROR_TAG ErrorClassTree ErrorClass = C.GIT_ERROR_TREE ErrorClassIndexer ErrorClass = C.GIT_ERROR_INDEXER ErrorClassSSL ErrorClass = C.GIT_ERROR_SSL ErrorClassSubmodule ErrorClass = C.GIT_ERROR_SUBMODULE ErrorClassThread ErrorClass = C.GIT_ERROR_THREAD ErrorClassStash ErrorClass = C.GIT_ERROR_STASH ErrorClassCheckout ErrorClass = C.GIT_ERROR_CHECKOUT ErrorClassFetchHead ErrorClass = C.GIT_ERROR_FETCHHEAD ErrorClassMerge ErrorClass = C.GIT_ERROR_MERGE ErrorClassSSH ErrorClass = C.GIT_ERROR_SSH ErrorClassFilter ErrorClass = C.GIT_ERROR_FILTER ErrorClassRevert ErrorClass = C.GIT_ERROR_REVERT ErrorClassCallback ErrorClass = C.GIT_ERROR_CALLBACK ErrorClassRebase ErrorClass = C.GIT_ERROR_REBASE ErrorClassPatch ErrorClass = C.GIT_ERROR_PATCH )
func (ErrorClass) String ¶ added in v30.3.0
func (i ErrorClass) String() string
type ErrorCode ¶
type ErrorCode int
const ( // ErrorCodeOK indicates that the operation completed successfully. ErrorCodeOK ErrorCode = C.GIT_OK // ErrorCodeGeneric represents a generic error. ErrorCodeGeneric ErrorCode = C.GIT_ERROR // ErrorCodeNotFound represents that the requested object could not be found ErrorCodeNotFound ErrorCode = C.GIT_ENOTFOUND // ErrorCodeExists represents that the object exists preventing operation. ErrorCodeExists ErrorCode = C.GIT_EEXISTS // ErrorCodeAmbiguous represents that more than one object matches. ErrorCodeAmbiguous ErrorCode = C.GIT_EAMBIGUOUS // ErrorCodeBuffs represents that the output buffer is too short to hold data. ErrorCodeBuffs ErrorCode = C.GIT_EBUFS // ErrorCodeUser is a special error that is never generated by libgit2 // code. You can return it from a callback (e.g to stop an iteration) // to know that it was generated by the callback and not by libgit2. ErrorCodeUser ErrorCode = C.GIT_EUSER // ErrorCodeBareRepo represents that the operation not allowed on bare repository ErrorCodeBareRepo ErrorCode = C.GIT_EBAREREPO // ErrorCodeUnbornBranch represents that HEAD refers to branch with no commits. ErrorCodeUnbornBranch ErrorCode = C.GIT_EUNBORNBRANCH // ErrorCodeUnmerged represents that a merge in progress prevented operation. ErrorCodeUnmerged ErrorCode = C.GIT_EUNMERGED // ErrorCodeNonFastForward represents that the reference was not fast-forwardable. ErrorCodeNonFastForward ErrorCode = C.GIT_ENONFASTFORWARD // ErrorCodeInvalidSpec represents that the name/ref spec was not in a valid format. ErrorCodeInvalidSpec ErrorCode = C.GIT_EINVALIDSPEC // ErrorCodeConflict represents that checkout conflicts prevented operation. ErrorCodeConflict ErrorCode = C.GIT_ECONFLICT // ErrorCodeLocked represents that lock file prevented operation. ErrorCodeLocked ErrorCode = C.GIT_ELOCKED // ErrorCodeModified represents that the reference value does not match expected. ErrorCodeModified ErrorCode = C.GIT_EMODIFIED // ErrorCodeAuth represents that the authentication failed. ErrorCodeAuth ErrorCode = C.GIT_EAUTH // ErrorCodeCertificate represents that the server certificate is invalid. ErrorCodeCertificate ErrorCode = C.GIT_ECERTIFICATE // ErrorCodeApplied represents that the patch/merge has already been applied. ErrorCodeApplied ErrorCode = C.GIT_EAPPLIED // ErrorCodePeel represents that the requested peel operation is not possible. ErrorCodePeel ErrorCode = C.GIT_EPEEL // ErrorCodeEOF represents an unexpected EOF. ErrorCodeEOF ErrorCode = C.GIT_EEOF // ErrorCodeInvalid represents an invalid operation or input. ErrorCodeInvalid ErrorCode = C.GIT_EINVALID // ErrorCodeUIncommitted represents that uncommitted changes in index prevented operation. ErrorCodeUncommitted ErrorCode = C.GIT_EUNCOMMITTED // ErrorCodeDirectory represents that the operation is not valid for a directory. ErrorCodeDirectory ErrorCode = C.GIT_EDIRECTORY // ErrorCodeMergeConflict represents that a merge conflict exists and cannot continue. ErrorCodeMergeConflict ErrorCode = C.GIT_EMERGECONFLICT // ErrorCodePassthrough represents that a user-configured callback refused to act. ErrorCodePassthrough ErrorCode = C.GIT_PASSTHROUGH // ErrorCodeIterOver signals end of iteration with iterator. ErrorCodeIterOver ErrorCode = C.GIT_ITEROVER // ErrorCodeRetry is an internal-only error code. ErrorCodeRetry ErrorCode = C.GIT_RETRY // ErrorCodeMismatch represents a hashsum mismatch in object. ErrorCodeMismatch ErrorCode = C.GIT_EMISMATCH // ErrorCodeIndexDirty represents that unsaved changes in the index would be overwritten. ErrorCodeIndexDirty ErrorCode = C.GIT_EINDEXDIRTY // ErrorCodeApplyFail represents that a patch application failed. ErrorCodeApplyFail ErrorCode = C.GIT_EAPPLYFAIL )
type Feature ¶
type Feature int
const ( // libgit2 was built with threading support FeatureThreads Feature = C.GIT_FEATURE_THREADS // libgit2 was built with HTTPS support built-in FeatureHTTPS Feature = C.GIT_FEATURE_HTTPS // libgit2 was build with SSH support built-in FeatureSSH Feature = C.GIT_FEATURE_SSH // libgit2 was built with nanosecond support for files FeatureNSec Feature = C.GIT_FEATURE_NSEC )
type FetchOptions ¶
type FetchOptions struct { // Callbacks to use for this fetch operation RemoteCallbacks RemoteCallbacks // Whether to perform a prune after the fetch Prune FetchPrune // Whether to write the results to FETCH_HEAD. Defaults to // on. Leave this default in order to behave like git. UpdateFetchhead bool // Determines how to behave regarding tags on the remote, such // as auto-downloading tags for objects we're downloading or // downloading all of them. // // The default is to auto-follow tags. DownloadTags DownloadTags // Headers are extra headers for the fetch operation. Headers []string // Proxy options to use for this fetch operation ProxyOptions ProxyOptions }
type FetchPrune ¶
type FetchPrune uint
const ( // Use the setting from the configuration FetchPruneUnspecified FetchPrune = C.GIT_FETCH_PRUNE_UNSPECIFIED // Force pruning on FetchPruneOn FetchPrune = C.GIT_FETCH_PRUNE // Force pruning off FetchNoPrune FetchPrune = C.GIT_FETCH_NO_PRUNE )
type Filemode ¶
type Filemode int
const ( FilemodeTree Filemode = C.GIT_FILEMODE_TREE FilemodeBlob Filemode = C.GIT_FILEMODE_BLOB FilemodeBlobExecutable Filemode = C.GIT_FILEMODE_BLOB_EXECUTABLE FilemodeLink Filemode = C.GIT_FILEMODE_LINK FilemodeCommit Filemode = C.GIT_FILEMODE_COMMIT )
type GitError ¶
type GitError struct { Message string Class ErrorClass Code ErrorCode }
type HandleList ¶
func NewHandleList ¶
func NewHandleList() *HandleList
func (*HandleList) Clear ¶ added in v30.0.5
func (v *HandleList) Clear()
Clear stops tracking all the managed pointers.
func (*HandleList) Get ¶
func (v *HandleList) Get(handle unsafe.Pointer) interface{}
Get retrieves the pointer from the given handle
func (*HandleList) Track ¶
func (v *HandleList) Track(pointer interface{}) unsafe.Pointer
Track adds the given pointer to the list of pointers to track and returns a pointer value which can be passed to C as an opaque pointer.
func (*HandleList) Untrack ¶
func (v *HandleList) Untrack(handle unsafe.Pointer)
Untrack stops tracking the pointer given by the handle
type HostkeyCertificate ¶
type HostkeyCertificate struct { Kind HostkeyKind HashMD5 [16]byte HashSHA1 [20]byte HashSHA256 [32]byte Hostkey []byte SSHPublicKey ssh.PublicKey }
Server host key information. A bitmask containing the available fields. Check for combinations of: HostkeyMD5, HostkeySHA1, HostkeySHA256, HostkeyRaw.
type HostkeyKind ¶
type HostkeyKind uint
HostkeyKind is a bitmask of the available hashes in HostkeyCertificate.
const ( HostkeyMD5 HostkeyKind = C.GIT_CERT_SSH_MD5 HostkeySHA1 HostkeyKind = C.GIT_CERT_SSH_SHA1 HostkeySHA256 HostkeyKind = C.GIT_CERT_SSH_SHA256 HostkeyRaw HostkeyKind = 1 << 3 )
type Index ¶
type Index struct {
// contains filtered or unexported fields
}
func NewIndex ¶
NewIndex allocates a new index. It won't be associated with any file on the filesystem or repository
func OpenIndex ¶
OpenIndex creates a new index at the given path. If the file does not exist it will be created when Write() is called.
func (*Index) Add ¶
func (v *Index) Add(entry *IndexEntry) error
Add adds or replaces the given entry to the index, making a copy of the data
func (*Index) AddAll ¶
func (v *Index) AddAll(pathspecs []string, flags IndexAddOption, callback IndexMatchedPathCallback) error
func (*Index) AddConflict ¶
func (v *Index) AddConflict(ancestor *IndexEntry, our *IndexEntry, their *IndexEntry) error
func (*Index) AddFromBuffer ¶
func (v *Index) AddFromBuffer(entry *IndexEntry, buffer []byte) error
AddFromBuffer adds or replaces an index entry from a buffer in memory
func (*Index) CleanupConflicts ¶
func (v *Index) CleanupConflicts()
FIXME: this might return an error
func (*Index) Clear ¶
Clear clears the index object in memory; changes must be explicitly written to disk for them to take effect persistently
func (*Index) Conflict ¶ added in v30.0.3
func (v *Index) Conflict(path string) (IndexConflict, error)
func (*Index) ConflictIterator ¶
func (v *Index) ConflictIterator() (*IndexConflictIterator, error)
func (*Index) EntryByIndex ¶
func (v *Index) EntryByIndex(index uint) (*IndexEntry, error)
func (*Index) EntryByPath ¶
func (v *Index) EntryByPath(path string, stage int) (*IndexEntry, error)
func (*Index) EntryCount ¶
func (*Index) GetConflict ¶
func (v *Index) GetConflict(path string) (IndexConflict, error)
deprecated: You should use `Index.Conflict()` instead.
func (*Index) HasConflicts ¶
func (*Index) Path ¶
Path returns the index' path on disk or an empty string if it exists only in memory.
func (*Index) RemoveAll ¶
func (v *Index) RemoveAll(pathspecs []string, callback IndexMatchedPathCallback) error
func (*Index) RemoveByPath ¶
func (*Index) RemoveConflict ¶
func (*Index) RemoveDirectory ¶
RemoveDirectory removes all entries from the index under a given directory.
func (*Index) UpdateAll ¶
func (v *Index) UpdateAll(pathspecs []string, callback IndexMatchedPathCallback) error
func (*Index) WriteTreeTo ¶
func (v *Index) WriteTreeTo(repo *Repository) (*Oid, error)
type IndexAddOption ¶ added in v30.3.0
type IndexAddOption uint
IndexAddOption is a set of flags for APIs that add files matching pathspec.
const ( IndexAddDefault IndexAddOption = C.GIT_INDEX_ADD_DEFAULT IndexAddForce IndexAddOption = C.GIT_INDEX_ADD_FORCE IndexAddDisablePathspecMatch IndexAddOption = C.GIT_INDEX_ADD_DISABLE_PATHSPEC_MATCH IndexAddCheckPathspec IndexAddOption = C.GIT_INDEX_ADD_CHECK_PATHSPEC )
type IndexAddOpts
deprecated
type IndexAddOpts = IndexAddOption
Deprecated: IndexAddOpts is a deprecated alias of IndexAddOption.
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 ¶
func (v *IndexConflictIterator) Next() (IndexConflict, error)
type IndexEntry ¶
type IndexStageOpts
deprecated
type IndexStageOpts = IndexStageState
Deprecated: IndexStageOpts is a deprecated alias of IndexStageState.
type IndexStageState ¶ added in v30.3.0
type IndexStageState int
IndexStageState indicates the state of the git index.
const ( // IndexStageAny matches any index stage. // // Some index APIs take a stage to match; pass this value to match // any entry matching the path regardless of stage. IndexStageAny IndexStageState = C.GIT_INDEX_STAGE_ANY // IndexStageNormal is a normal staged file in the index. IndexStageNormal IndexStageState = C.GIT_INDEX_STAGE_NORMAL // IndexStageAncestor is the ancestor side of a conflict. IndexStageAncestor IndexStageState = C.GIT_INDEX_STAGE_ANCESTOR // IndexStageOurs is the "ours" side of a conflict. IndexStageOurs IndexStageState = C.GIT_INDEX_STAGE_OURS // IndexStageTheirs is the "theirs" side of a conflict. IndexStageTheirs IndexStageState = C.GIT_INDEX_STAGE_THEIRS )
type Indexer ¶
type Indexer struct {
// contains filtered or unexported fields
}
Indexer can post-process packfiles and create an .idx file for efficient lookup.
func NewIndexer ¶
func NewIndexer(packfilePath string, odb *Odb, callback TransferProgressCallback) (indexer *Indexer, err error)
NewIndexer creates a new indexer instance.
type Mempack ¶
type Mempack struct {
// contains filtered or unexported fields
}
Mempack is a custom ODB backend that permits packing object in-memory.
func NewMempack ¶
NewMempack creates a new mempack instance and registers it to the ODB.
func (*Mempack) Dump ¶
func (mempack *Mempack) Dump(repository *Repository) ([]byte, error)
Dump dumps all the queued in-memory writes to a packfile.
It is the caller's responsibility to ensure that the generated packfile is available to the repository (e.g. by writing it to disk, or doing something crazy like distributing it across several copies of the repository over a network).
Once the generated packfile is available to the repository, call Mempack.Reset to cleanup the memory store.
Calling Mempack.Reset before the packfile has been written to disk will result in an inconsistent repository (the objects in the memory store won't be accessible).
type MergeAnalysis ¶
type MergeAnalysis int
const ( MergeAnalysisNone MergeAnalysis = C.GIT_MERGE_ANALYSIS_NONE MergeAnalysisNormal MergeAnalysis = C.GIT_MERGE_ANALYSIS_NORMAL MergeAnalysisUpToDate MergeAnalysis = C.GIT_MERGE_ANALYSIS_UP_TO_DATE MergeAnalysisFastForward MergeAnalysis = C.GIT_MERGE_ANALYSIS_FASTFORWARD MergeAnalysisUnborn MergeAnalysis = C.GIT_MERGE_ANALYSIS_UNBORN )
type MergeFileFavor ¶
type MergeFileFavor int
const ( MergeFileFavorNormal MergeFileFavor = C.GIT_MERGE_FILE_FAVOR_NORMAL MergeFileFavorOurs MergeFileFavor = C.GIT_MERGE_FILE_FAVOR_OURS MergeFileFavorTheirs MergeFileFavor = C.GIT_MERGE_FILE_FAVOR_THEIRS MergeFileFavorUnion MergeFileFavor = C.GIT_MERGE_FILE_FAVOR_UNION )
type MergeFileFlags ¶
type MergeFileFlags int
const ( MergeFileDefault MergeFileFlags = C.GIT_MERGE_FILE_DEFAULT // Create standard conflicted merge files MergeFileStyleMerge MergeFileFlags = C.GIT_MERGE_FILE_STYLE_MERGE // Create diff3-style files MergeFileStyleDiff MergeFileFlags = C.GIT_MERGE_FILE_STYLE_DIFF3 // Condense non-alphanumeric regions for simplified diff file MergeFileStyleSimplifyAlnum MergeFileFlags = C.GIT_MERGE_FILE_SIMPLIFY_ALNUM // Ignore all whitespace MergeFileIgnoreWhitespace MergeFileFlags = C.GIT_MERGE_FILE_IGNORE_WHITESPACE // Ignore changes in amount of whitespace MergeFileIgnoreWhitespaceChange MergeFileFlags = C.GIT_MERGE_FILE_IGNORE_WHITESPACE_CHANGE // Ignore whitespace at end of line MergeFileIgnoreWhitespaceEOL MergeFileFlags = C.GIT_MERGE_FILE_IGNORE_WHITESPACE_EOL // Use the "patience diff" algorithm MergeFileDiffPatience MergeFileFlags = C.GIT_MERGE_FILE_DIFF_PATIENCE // Take extra time to find minimal diff MergeFileDiffMinimal MergeFileFlags = C.GIT_MERGE_FILE_DIFF_MINIMAL )
type MergeFileInput ¶
type MergeFileOptions ¶
type MergeFileOptions struct { AncestorLabel string OurLabel string TheirLabel string Favor MergeFileFavor Flags MergeFileFlags MarkerSize uint16 }
type MergeFileResult ¶
type MergeFileResult struct { Automergeable bool Path string Mode uint Contents []byte // contains filtered or unexported fields }
func MergeFile ¶
func MergeFile(ancestor MergeFileInput, ours MergeFileInput, theirs MergeFileInput, options *MergeFileOptions) (*MergeFileResult, error)
func (*MergeFileResult) Free ¶
func (r *MergeFileResult) Free()
type MergeOptions ¶
type MergeOptions struct { Version uint TreeFlags MergeTreeFlag RenameThreshold uint TargetLimit uint RecursionLimit uint FileFavor MergeFileFavor }
func DefaultMergeOptions ¶
func DefaultMergeOptions() (MergeOptions, error)
type MergePreference ¶
type MergePreference int
const ( MergePreferenceNone MergePreference = C.GIT_MERGE_PREFERENCE_NONE MergePreferenceNoFastForward MergePreference = C.GIT_MERGE_PREFERENCE_NO_FASTFORWARD MergePreferenceFastForwardOnly MergePreference = C.GIT_MERGE_PREFERENCE_FASTFORWARD_ONLY )
type MergeTreeFlag ¶
type MergeTreeFlag int
const ( // Detect renames that occur between the common ancestor and the "ours" // side or the common ancestor and the "theirs" side. This will enable // the ability to merge between a modified and renamed file. MergeTreeFindRenames MergeTreeFlag = C.GIT_MERGE_FIND_RENAMES // If a conflict occurs, exit immediately instead of attempting to // continue resolving conflicts. The merge operation will fail with // GIT_EMERGECONFLICT and no index will be returned. MergeTreeFailOnConflict MergeTreeFlag = C.GIT_MERGE_FAIL_ON_CONFLICT // MergeTreeSkipREUC specifies not to write the REUC extension on the // generated index. MergeTreeSkipREUC MergeTreeFlag = C.GIT_MERGE_SKIP_REUC // MergeTreeNoRecursive specifies not to build a recursive merge base (by // merging the multiple merge bases) if the commits being merged have // multiple merge bases. Instead, the first base is used. // This flag provides a similar merge base to `git-merge-resolve`. MergeTreeNoRecursive MergeTreeFlag = C.GIT_MERGE_NO_RECURSIVE )
type MessageEncoding ¶ added in v30.3.16
type MessageEncoding string
MessageEncoding is the encoding of commit messages.
const ( // MessageEncodingUTF8 is the default message encoding. MessageEncodingUTF8 MessageEncoding = "UTF-8" )
type Note ¶
type Note struct {
// contains filtered or unexported fields
}
Note
type NoteCollection ¶
type NoteCollection struct {
// contains filtered or unexported fields
}
This object represents the possible operations which can be performed on the collection of notes for a repository.
func (*NoteCollection) Create ¶
func (c *NoteCollection) Create( ref string, author, committer *Signature, id *Oid, note string, force bool) (*Oid, error)
Create adds a note for an object
func (*NoteCollection) DefaultRef ¶
func (c *NoteCollection) DefaultRef() (string, error)
DefaultRef returns the default notes reference for a repository
type NoteIterator ¶
type NoteIterator struct {
// contains filtered or unexported fields
}
NoteIterator
func (*NoteIterator) Next ¶
func (it *NoteIterator) Next() (noteId, annotatedId *Oid, err error)
Next returns the current item (note id & annotated id) and advances the iterator internally to the next item
type Object ¶
type Object struct {
// contains filtered or unexported fields
}
func (*Object) Owner ¶
func (o *Object) Owner() *Repository
Owner returns a weak reference to the repository which owns this object. This won't keep the underlying repository alive, but it should still be Freed.
func (*Object) Peel ¶
func (o *Object) Peel(t ObjectType) (*Object, error)
Peel recursively peels an object until an object of the specified type is met.
If the query cannot be satisfied due to the object model, ErrorCodeInvalidSpec will be returned (e.g. trying to peel a blob to a tree).
If you pass ObjectAny as the target type, then the object will be peeled until the type changes. A tag will be peeled until the referenced object is no longer a tag, and a commit will be peeled to a tree. Any other object type will return ErrorCodeInvalidSpec.
If peeling a tag we discover an object which cannot be peeled to the target type due to the object model, an error will be returned.
func (*Object) Type ¶
func (o *Object) Type() ObjectType
type ObjectType ¶
type ObjectType int
const ( ObjectAny ObjectType = C.GIT_OBJECT_ANY ObjectInvalid ObjectType = C.GIT_OBJECT_INVALID ObjectCommit ObjectType = C.GIT_OBJECT_COMMIT ObjectTree ObjectType = C.GIT_OBJECT_TREE ObjectBlob ObjectType = C.GIT_OBJECT_BLOB ObjectTag ObjectType = C.GIT_OBJECT_TAG )
func (ObjectType) String ¶
func (t ObjectType) String() string
type Objecter ¶
type Objecter interface {
AsObject() *Object
}
Objecter lets us accept any kind of Git object in functions.
type Odb ¶
type Odb struct {
// contains filtered or unexported fields
}
func (*Odb) AddAlternate ¶
func (v *Odb) AddAlternate(backend *OdbBackend, priority int) (err error)
func (*Odb) AddBackend ¶
func (v *Odb) AddBackend(backend *OdbBackend, priority int) (err error)
func (*Odb) ForEach ¶
func (v *Odb) ForEach(callback OdbForEachCallback) error
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) NewWritePack ¶
func (v *Odb) NewWritePack(callback TransferProgressCallback) (*OdbWritepack, error)
NewWritePack opens a stream for writing a pack file to the ODB. If the ODB layer understands pack files, then the given packfile will likely be streamed directly to disk (and a corresponding index created). If the ODB layer does not understand pack files, the objects will be stored in whatever format the ODB layer uses.
func (*Odb) NewWriteStream ¶
func (v *Odb) NewWriteStream(size int64, 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) ReadHeader ¶
func (v *Odb) ReadHeader(oid *Oid) (uint64, ObjectType, error)
type OdbBackend ¶
type OdbBackend struct {
// contains filtered or unexported fields
}
func NewOdbBackendFromC ¶
func NewOdbBackendFromC(ptr unsafe.Pointer) (backend *OdbBackend)
func NewOdbBackendLoose ¶
func NewOdbBackendLoose(objectsDir string, compressionLevel int, doFsync bool, dirMode os.FileMode, fileMode os.FileMode) (backend *OdbBackend, err error)
NewOdbBackendLoose creates a backend for loose objects.
func NewOdbBackendOnePack ¶
func NewOdbBackendOnePack(packfileIndexPath string) (backend *OdbBackend, err error)
func (*OdbBackend) Free ¶
func (v *OdbBackend) Free()
type OdbForEachCallback ¶
type OdbObject ¶
type OdbObject struct {
// contains filtered or unexported fields
}
func (*OdbObject) Data ¶
Data returns a slice pointing to the unmanaged object memory. You must make sure the object is referenced for at least as long as the slice is used.
func (*OdbObject) Type ¶
func (object *OdbObject) Type() ObjectType
type OdbReadStream ¶
type OdbReadStream struct { Size uint64 Type ObjectType // 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()
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()
type OdbWritepack ¶
type OdbWritepack struct {
// contains filtered or unexported fields
}
OdbWritepack is a stream to write a packfile to the ODB.
func (*OdbWritepack) Commit ¶
func (writepack *OdbWritepack) Commit() error
func (*OdbWritepack) Free ¶
func (writepack *OdbWritepack) Free()
type Packbuilder ¶
type Packbuilder struct {
// contains filtered or unexported fields
}
func (*Packbuilder) ForEach ¶
func (pb *Packbuilder) ForEach(callback PackbuilderForeachCallback) error
ForEach repeatedly calls the callback with new packfile data until there is no more data or the callback returns an error
func (*Packbuilder) Free ¶
func (pb *Packbuilder) Free()
func (*Packbuilder) InsertCommit ¶
func (pb *Packbuilder) InsertCommit(id *Oid) error
func (*Packbuilder) InsertTree ¶
func (pb *Packbuilder) InsertTree(id *Oid) error
func (*Packbuilder) InsertWalk ¶
func (pb *Packbuilder) InsertWalk(walk *RevWalk) error
func (*Packbuilder) ObjectCount ¶
func (pb *Packbuilder) ObjectCount() uint32
func (*Packbuilder) WriteToFile ¶
func (pb *Packbuilder) WriteToFile(name string, mode os.FileMode) error
func (*Packbuilder) Written ¶
func (pb *Packbuilder) Written() uint32
type ProxyOptions ¶
type ProxyType ¶
type ProxyType uint
const ( // Do not attempt to connect through a proxy // // If built against lbicurl, it itself may attempt to connect // to a proxy if the environment variables specify it. ProxyTypeNone ProxyType = C.GIT_PROXY_NONE // Try to auto-detect the proxy from the git configuration. ProxyTypeAuto ProxyType = C.GIT_PROXY_AUTO // Connect via the URL given in the options ProxyTypeSpecified ProxyType = C.GIT_PROXY_SPECIFIED )
type PushOptions ¶
type PushOptions struct { // Callbacks to use for this push operation RemoteCallbacks RemoteCallbacks PbParallelism uint // Headers are extra headers for the push operation. Headers []string // Proxy options to use for this push operation ProxyOptions ProxyOptions }
type Rebase ¶
type Rebase struct {
// contains filtered or unexported fields
}
Rebase is the struct representing a Rebase object.
func (*Rebase) Abort ¶
Abort aborts a rebase that is currently in progress, resetting the repository and working directory to their state before rebase began.
func (*Rebase) Commit ¶
Commit commits the current patch. You must have resolved any conflicts that were introduced during the patch application from the Next() invocation.
func (*Rebase) CurrentOperationIndex ¶
CurrentOperationIndex gets the index of the rebase operation that is currently being applied. There is also an error returned for API compatibility.
func (*Rebase) Finish ¶
Finish finishes a rebase that is currently in progress once all patches have been applied.
func (*Rebase) InmemoryIndex ¶ added in v30.6.8
InmemoryIndex gets the index produced by the last operation, which is the result of `Next()` and which will be committed by the next invocation of `Commit()`. This is useful for resolving conflicts in an in-memory rebase before committing them.
This is only applicable for in-memory rebases; for rebases within a working directory, the changes were applied to the repository's index.
func (*Rebase) Next ¶
func (rebase *Rebase) Next() (*RebaseOperation, error)
Next performs the next rebase operation and returns the information about it. If the operation is one that applies a patch (which is any operation except RebaseOperationExec) then the patch will be applied and the index and working directory will be updated with the changes. If there are conflicts, you will need to address those before committing the changes.
func (*Rebase) OperationAt ¶
func (rebase *Rebase) OperationAt(index uint) *RebaseOperation
OperationAt gets the rebase operation specified by the given index.
func (*Rebase) OperationCount ¶
OperationCount gets the count of rebase operations that are to be applied.
type RebaseOperation ¶
type RebaseOperation struct { Type RebaseOperationType Id *Oid Exec string }
RebaseOperation describes a single instruction/operation to be performed during the rebase.
type RebaseOperationType ¶
type RebaseOperationType uint
RebaseOperationType is the type of rebase operation
const ( // RebaseOperationPick The given commit is to be cherry-picked. The client should commit the changes and continue if there are no conflicts. RebaseOperationPick RebaseOperationType = C.GIT_REBASE_OPERATION_PICK // RebaseOperationReword The given commit is to be cherry-picked, but the client should prompt the user to provide an updated commit message. RebaseOperationReword RebaseOperationType = C.GIT_REBASE_OPERATION_REWORD // RebaseOperationEdit The given commit is to be cherry-picked, but the client should stop to allow the user to edit the changes before committing them. RebaseOperationEdit RebaseOperationType = C.GIT_REBASE_OPERATION_EDIT // RebaseOperationSquash The given commit is to be squashed into the previous commit. The commit message will be merged with the previous message. RebaseOperationSquash RebaseOperationType = C.GIT_REBASE_OPERATION_SQUASH // RebaseOperationFixup No commit will be cherry-picked. The client should run the given command and (if successful) continue. RebaseOperationFixup RebaseOperationType = C.GIT_REBASE_OPERATION_FIXUP // RebaseOperationExec No commit will be cherry-picked. The client should run the given command and (if successful) continue. RebaseOperationExec RebaseOperationType = C.GIT_REBASE_OPERATION_EXEC )
func (RebaseOperationType) String ¶
func (t RebaseOperationType) String() string
type RebaseOptions ¶
type RebaseOptions struct { Version uint Quiet int InMemory int RewriteNotesRef string MergeOptions MergeOptions CheckoutOptions CheckoutOptions CommitSigningCallback CommitSigningCallback }
RebaseOptions are used to tell the rebase machinery how to operate
func DefaultRebaseOptions ¶
func DefaultRebaseOptions() (RebaseOptions, error)
DefaultRebaseOptions returns a RebaseOptions with default values.
type Refdb ¶
type Refdb struct {
// contains filtered or unexported fields
}
func (*Refdb) SetBackend ¶
func (v *Refdb) SetBackend(backend *RefdbBackend) (err error)
type RefdbBackend ¶
type RefdbBackend struct {
// contains filtered or unexported fields
}
func NewRefdbBackendFromC ¶
func NewRefdbBackendFromC(ptr unsafe.Pointer) (backend *RefdbBackend)
func (*RefdbBackend) Free ¶
func (v *RefdbBackend) Free()
type Reference ¶
type Reference struct {
// contains filtered or unexported fields
}
func (*Reference) Cmp ¶
Cmp compares v to ref2. It returns 0 on equality, otherwise a stable sorting.
func (*Reference) Owner ¶
func (v *Reference) Owner() *Repository
Owner returns a weak reference to the repository which owns this reference. This won't keep the underlying repository alive, but it should still be Freed.
func (*Reference) SetSymbolicTarget ¶
func (*Reference) SymbolicTarget ¶
func (*Reference) Type ¶
func (v *Reference) Type() ReferenceType
type ReferenceCollection ¶
type ReferenceCollection struct {
// contains filtered or unexported fields
}
func (*ReferenceCollection) CreateSymbolic ¶
func (*ReferenceCollection) Dwim ¶
func (c *ReferenceCollection) Dwim(name string) (*Reference, error)
Dwim looks up a reference by DWIMing its short name
func (*ReferenceCollection) EnsureLog ¶
func (c *ReferenceCollection) EnsureLog(name string) error
EnsureLog ensures that there is a reflog for the given reference name and creates an empty one if necessary.
type ReferenceFormat ¶ added in v30.2.2
type ReferenceFormat uint
const ( ReferenceFormatNormal ReferenceFormat = C.GIT_REFERENCE_FORMAT_NORMAL ReferenceFormatAllowOnelevel ReferenceFormat = C.GIT_REFERENCE_FORMAT_ALLOW_ONELEVEL ReferenceFormatRefspecPattern ReferenceFormat = C.GIT_REFERENCE_FORMAT_REFSPEC_PATTERN ReferenceFormatRefspecShorthand ReferenceFormat = C.GIT_REFERENCE_FORMAT_REFSPEC_SHORTHAND )
type ReferenceIterator ¶
type ReferenceIterator struct {
// contains filtered or unexported fields
}
func (*ReferenceIterator) Names ¶
func (i *ReferenceIterator) Names() *ReferenceNameIterator
func (*ReferenceIterator) Next ¶
func (v *ReferenceIterator) Next() (*Reference, error)
Next retrieves the next reference. If the iterationis over, the returned error code is git.ErrorCodeIterOver
type ReferenceNameIterator ¶
type ReferenceNameIterator struct { *ReferenceIterator // contains filtered or unexported fields }
func (*ReferenceNameIterator) Next ¶
func (v *ReferenceNameIterator) Next() (string, error)
NextName retrieves the next reference name. If the iteration is over, the returned error code is git.ErrorCodeIterOver
type ReferenceType ¶
type ReferenceType int
const ( ReferenceSymbolic ReferenceType = C.GIT_REF_SYMBOLIC ReferenceOid ReferenceType = C.GIT_REF_OID )
type Refspec ¶ added in v30.6.9
type Refspec struct {
// contains filtered or unexported fields
}
func ParseRefspec ¶ added in v30.6.9
ParseRefspec parses a given refspec string
func (*Refspec) Direction ¶ added in v30.6.9
func (s *Refspec) Direction() ConnectDirection
Direction returns the refspec's direction
func (*Refspec) DstMatches ¶ added in v30.6.9
SrcMatches checks if a refspec's destination descriptor matches a reference
func (*Refspec) Free ¶ added in v30.6.9
func (s *Refspec) Free()
Free releases a refspec object which has been created by ParseRefspec
func (*Refspec) Rtransform ¶ added in v30.6.9
Rtransform converts a target reference to its source reference following the refspec's rules
func (*Refspec) SrcMatches ¶ added in v30.6.9
SrcMatches checks if a refspec's source descriptor matches a reference
type RegisteredSmartTransport ¶ added in v30.4.2
type RegisteredSmartTransport struct {
// contains filtered or unexported fields
}
RegisteredSmartTransport represents a transport that has been registered.
func NewRegisteredSmartTransport ¶ added in v30.4.2
func NewRegisteredSmartTransport( name string, stateless bool, callback SmartSubtransportCallback, ) (*RegisteredSmartTransport, error)
NewRegisteredSmartTransport adds a custom transport definition, to be used in addition to the built-in set of transports that come with libgit2.
func RegisterManagedHTTPTransport ¶ added in v30.4.3
func RegisterManagedHTTPTransport(protocol string) (*RegisteredSmartTransport, error)
RegisterManagedHTTPTransport registers a Go-native implementation of an HTTP/S transport that doesn't rely on any system libraries (e.g. libopenssl/libmbedtls).
If Shutdown or ReInit are called, make sure that the smart transports are freed before it.
func RegisterManagedSSHTransport ¶ added in v30.5.0
func RegisterManagedSSHTransport(protocol string) (*RegisteredSmartTransport, error)
RegisterManagedSSHTransport registers a Go-native implementation of an SSH transport that doesn't rely on any system libraries (e.g. libssh2).
If Shutdown or ReInit are called, make sure that the smart transports are freed before it.
func (*RegisteredSmartTransport) Free ¶ added in v30.4.2
func (t *RegisteredSmartTransport) Free() error
Free releases all resources used by the RegisteredSmartTransport and unregisters the custom transport definition referenced by it.
type Remote ¶
type Remote struct {
// contains filtered or unexported fields
}
func (*Remote) Connect ¶
func (o *Remote) Connect(direction ConnectDirection, callbacks *RemoteCallbacks, proxyOpts *ProxyOptions, headers []string) error
Connect opens a connection to a remote.
The transport is selected based on the URL. The direction argument is due to a limitation of the git protocol (over TCP or SSH) which starts up a specific binary which can only do the one or the other.
'headers' are extra HTTP headers to use in this connection.
func (*Remote) ConnectFetch ¶
func (o *Remote) ConnectFetch(callbacks *RemoteCallbacks, proxyOpts *ProxyOptions, headers []string) error
func (*Remote) ConnectPush ¶
func (o *Remote) ConnectPush(callbacks *RemoteCallbacks, proxyOpts *ProxyOptions, headers []string) error
func (*Remote) Disconnect ¶
func (o *Remote) Disconnect()
func (*Remote) Fetch ¶
func (o *Remote) Fetch(refspecs []string, opts *FetchOptions, msg string) error
Fetch performs a fetch operation. refspecs specifies which refspecs to use for this fetch, use an empty list to use the refspecs from the configuration; msg specifies what to use for the reflog entries. Leave "" to use defaults.
func (*Remote) FetchRefspecs ¶
func (*Remote) Prune ¶
func (o *Remote) Prune(callbacks *RemoteCallbacks) error
func (*Remote) PushRefspecs ¶
func (*Remote) RefspecCount ¶
type RemoteCallbacks ¶
type RemoteCallbacks struct { SidebandProgressCallback TransportMessageCallback CompletionCallback CredentialsCallback TransferProgressCallback UpdateTipsCallback CertificateCheckCallback PackProgressCallback PackbuilderProgressCallback PushTransferProgressCallback PushUpdateReferenceCallback }
type RemoteCollection ¶
func (*RemoteCollection) AddFetch ¶
func (c *RemoteCollection) AddFetch(remote, refspec string) error
func (*RemoteCollection) AddPush ¶
func (c *RemoteCollection) AddPush(remote, refspec string) error
func (*RemoteCollection) Create ¶
func (c *RemoteCollection) Create(name string, url string) (*Remote, error)
func (*RemoteCollection) CreateAnonymous ¶
func (c *RemoteCollection) CreateAnonymous(url string) (*Remote, error)
func (*RemoteCollection) CreateWithFetchspec ¶
func (*RemoteCollection) CreateWithOptions ¶ added in v30.3.8
func (c *RemoteCollection) CreateWithOptions(url string, option *RemoteCreateOptions) (*Remote, error)
CreateWithOptions Creates a repository object with extended options.
func (*RemoteCollection) Delete ¶
func (c *RemoteCollection) Delete(name string) error
func (*RemoteCollection) Free ¶ added in v30.4.2
func (c *RemoteCollection) Free()
func (*RemoteCollection) List ¶
func (c *RemoteCollection) List() ([]string, error)
func (*RemoteCollection) Rename ¶
func (c *RemoteCollection) Rename(remote, newname string) ([]string, error)
func (*RemoteCollection) SetPushUrl ¶
func (c *RemoteCollection) SetPushUrl(remote, url string) error
func (*RemoteCollection) SetUrl ¶
func (c *RemoteCollection) SetUrl(remote, url string) error
type RemoteCompletion ¶
type RemoteCompletion uint
type RemoteCreateCallback ¶
type RemoteCreateCallback func(repo *Repository, name, url string) (*Remote, ErrorCode)
type RemoteCreateOptions ¶ added in v30.3.8
type RemoteCreateOptions struct { Name string FetchSpec string Flags RemoteCreateOptionsFlag }
RemoteCreateOptions contains options for creating a remote
func DefaultRemoteCreateOptions ¶ added in v30.3.8
func DefaultRemoteCreateOptions() (*RemoteCreateOptions, error)
DefaultApplyOptions returns default options for remote create
type RemoteCreateOptionsFlag ¶ added in v30.3.8
type RemoteCreateOptionsFlag uint
RemoteCreateOptionsFlag is Remote creation options flags
const ( // Ignore the repository apply.insteadOf configuration RemoteCreateSkipInsteadof RemoteCreateOptionsFlag = C.GIT_REMOTE_CREATE_SKIP_INSTEADOF // Don't build a fetchspec from the name if none is set RemoteCreateSkipDefaultFetchspec RemoteCreateOptionsFlag = C.GIT_REMOTE_CREATE_SKIP_DEFAULT_FETCHSPEC )
type RemoteHead ¶
type Repository ¶
type Repository struct { // Remotes represents the collection of remotes and can be // used to add, remove and configure remotes for this // repository. Remotes RemoteCollection // Submodules represents the collection of submodules and can // be used to add, remove and configure submodules in this // repository. Submodules SubmoduleCollection // References represents the collection of references and can // be used to create, remove or update references for this repository. References ReferenceCollection // Notes represents the collection of notes and can be used to // read, write and delete notes from this repository. Notes NoteCollection // Tags represents the collection of tags and can be used to create, // list, iterate and remove tags in this repository. Tags TagsCollection // Stashes represents the collection of stashes and can be used to // save, apply and iterate over stash states in this repository. Stashes StashCollection // 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 NewRepositoryWrapOdb ¶
func NewRepositoryWrapOdb(odb *Odb) (repo *Repository, err error)
func OpenRepository ¶
func OpenRepository(path string) (*Repository, error)
func OpenRepositoryExtended ¶
func OpenRepositoryExtended(path string, flags RepositoryOpenFlag, ceiling string) (*Repository, error)
func (*Repository) AddGitIgnoreRules ¶
func (r *Repository) AddGitIgnoreRules(rules string) error
func (*Repository) AddIgnoreRule ¶
func (v *Repository) AddIgnoreRule(rules string) error
func (*Repository) AheadBehind ¶
func (repo *Repository) AheadBehind(local, upstream *Oid) (ahead, behind int, err error)
func (*Repository) AnnotatedCommitFromFetchHead ¶
func (r *Repository) AnnotatedCommitFromFetchHead(branchName string, remoteURL string, oid *Oid) (*AnnotatedCommit, error)
func (*Repository) AnnotatedCommitFromRef ¶
func (r *Repository) AnnotatedCommitFromRef(ref *Reference) (*AnnotatedCommit, error)
func (*Repository) AnnotatedCommitFromRevspec ¶
func (r *Repository) AnnotatedCommitFromRevspec(spec string) (*AnnotatedCommit, error)
func (*Repository) ApplyDiff ¶ added in v30.0.8
func (v *Repository) ApplyDiff(diff *Diff, location ApplyLocation, opts *ApplyOptions) error
ApplyDiff appllies a Diff to the given repository, making changes directly in the working directory, the index, or both.
func (*Repository) ApplyToTree ¶ added in v30.0.17
func (v *Repository) ApplyToTree(diff *Diff, tree *Tree, opts *ApplyOptions) (*Index, error)
ApplyToTree applies a Diff to a Tree and returns the resulting image as an Index.
func (*Repository) BlameFile ¶
func (v *Repository) BlameFile(path string, opts *BlameOptions) (*Blame, error)
func (*Repository) CheckoutHead ¶
func (v *Repository) CheckoutHead(opts *CheckoutOptions) 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 *CheckoutOptions) 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) CheckoutTree ¶
func (v *Repository) CheckoutTree(tree *Tree, opts *CheckoutOptions) error
func (*Repository) Cherrypick ¶
func (v *Repository) Cherrypick(commit *Commit, opts CherrypickOptions) error
func (*Repository) CherrypickCommit ¶
func (r *Repository) CherrypickCommit(pick, our *Commit, opts CherrypickOptions) (*Index, error)
func (*Repository) ClearGitIgnoreRules ¶
func (r *Repository) ClearGitIgnoreRules() error
func (*Repository) ClearInternalIgnoreRules ¶
func (v *Repository) ClearInternalIgnoreRules() error
func (*Repository) Config ¶
func (v *Repository) Config() (*Config, error)
func (*Repository) CreateBlobFromBuffer ¶
func (repo *Repository) CreateBlobFromBuffer(data []byte) (*Oid, error)
func (*Repository) CreateBranch ¶
func (*Repository) CreateCommit ¶
func (*Repository) CreateCommitBuffer ¶ added in v30.3.16
func (v *Repository) CreateCommitBuffer( author, committer *Signature, messageEncoding MessageEncoding, message string, tree *Tree, parents ...*Commit, ) ([]byte, error)
CreateCommitBuffer creates a commit and write it into a buffer.
func (*Repository) CreateCommitFromIds ¶
func (*Repository) CreateCommitWithSignature ¶ added in v30.3.18
func (v *Repository) CreateCommitWithSignature( commitContent, signature, signatureField string, ) (*Oid, error)
CreateCommitWithSignature creates a commit object from the given contents and signature.
func (*Repository) CreateFromStream ¶
func (repo *Repository) CreateFromStream(hintPath string) (*BlobWriteStream, error)
func (*Repository) DefaultSignature ¶
func (repo *Repository) DefaultSignature() (*Signature, error)
func (*Repository) DescendantOf ¶
func (repo *Repository) DescendantOf(commit, ancestor *Oid) (bool, error)
func (*Repository) DescribeWorkdir ¶
func (repo *Repository) DescribeWorkdir(opts *DescribeOptions) (*DescribeResult, error)
DescribeWorkdir describes the working tree. It means describe HEAD and appends <mark> (-dirty by default) if the working tree is dirty.
func (*Repository) DiffIndexToWorkdir ¶
func (v *Repository) DiffIndexToWorkdir(index *Index, opts *DiffOptions) (*Diff, error)
func (*Repository) DiffTreeToIndex ¶
func (v *Repository) DiffTreeToIndex(oldTree *Tree, index *Index, opts *DiffOptions) (*Diff, error)
func (*Repository) DiffTreeToTree ¶
func (v *Repository) DiffTreeToTree(oldTree, newTree *Tree, opts *DiffOptions) (*Diff, error)
func (*Repository) DiffTreeToWorkdir ¶
func (v *Repository) DiffTreeToWorkdir(oldTree *Tree, opts *DiffOptions) (*Diff, error)
func (*Repository) DiffTreeToWorkdirWithIndex ¶
func (v *Repository) DiffTreeToWorkdirWithIndex(oldTree *Tree, opts *DiffOptions) (*Diff, error)
func (*Repository) Free ¶
func (v *Repository) Free()
func (*Repository) Head ¶
func (v *Repository) Head() (*Reference, error)
func (*Repository) Index ¶
func (v *Repository) Index() (*Index, error)
func (*Repository) InitRebase ¶
func (r *Repository) InitRebase(branch *AnnotatedCommit, upstream *AnnotatedCommit, onto *AnnotatedCommit, opts *RebaseOptions) (*Rebase, error)
InitRebase initializes a rebase operation to rebase the changes in branch relative to upstream onto another branch.
func (*Repository) IsBare ¶
func (repo *Repository) IsBare() bool
func (*Repository) IsEmpty ¶
func (v *Repository) IsEmpty() (bool, error)
func (*Repository) IsHeadDetached ¶
func (v *Repository) IsHeadDetached() (bool, error)
func (*Repository) IsHeadUnborn ¶
func (v *Repository) IsHeadUnborn() (bool, error)
func (*Repository) IsPathIgnored ¶
func (v *Repository) IsPathIgnored(path string) (bool, error)
func (*Repository) IsShallow ¶
func (v *Repository) IsShallow() (bool, error)
func (*Repository) ItemPath ¶ added in v30.3.12
func (r *Repository) ItemPath(item RepositoryItem) (string, error)
func (*Repository) LookupAnnotatedCommit ¶
func (r *Repository) LookupAnnotatedCommit(oid *Oid) (*AnnotatedCommit, 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) LookupPrefix ¶ added in v30.0.14
func (v *Repository) LookupPrefix(id *Oid, prefix uint) (*Object, error)
LookupPrefix looks up an object by its OID given a prefix of its identifier.
func (*Repository) LookupPrefixBlob ¶ added in v30.0.14
func (v *Repository) LookupPrefixBlob(id *Oid, prefix uint) (*Blob, error)
LookupPrefixBlob looks up a blob by its OID given a prefix of its identifier.
func (*Repository) LookupPrefixCommit ¶ added in v30.0.14
func (v *Repository) LookupPrefixCommit(id *Oid, prefix uint) (*Commit, error)
LookupPrefixCommit looks up a commit by its OID given a prefix of its identifier.
func (*Repository) LookupPrefixTag ¶ added in v30.0.14
func (v *Repository) LookupPrefixTag(id *Oid, prefix uint) (*Tag, error)
LookupPrefixTag looks up a tag by its OID given a prefix of its identifier.
func (*Repository) LookupPrefixTree ¶ added in v30.0.14
func (v *Repository) LookupPrefixTree(id *Oid, prefix uint) (*Tree, error)
LookupPrefixTree looks up a tree by its OID given a prefix of its identifier.
func (*Repository) LookupTree ¶
func (v *Repository) LookupTree(id *Oid) (*Tree, error)
func (*Repository) Merge ¶
func (r *Repository) Merge(theirHeads []*AnnotatedCommit, mergeOptions *MergeOptions, checkoutOptions *CheckoutOptions) error
func (*Repository) MergeAnalysis ¶
func (r *Repository) MergeAnalysis(theirHeads []*AnnotatedCommit) (MergeAnalysis, MergePreference, error)
MergeAnalysis returns the possible actions which could be taken by a 'git-merge' command. There may be multiple answers, so the first return value is a bitmask of MergeAnalysis values.
func (*Repository) MergeBaseMany ¶ added in v30.3.5
func (r *Repository) MergeBaseMany(oids []*Oid) (*Oid, error)
MergeBaseMany finds a merge base given a list of commits.
func (*Repository) MergeBaseOctopus ¶ added in v30.3.5
func (r *Repository) MergeBaseOctopus(oids []*Oid) (*Oid, error)
MergeBaseOctopus finds a merge base in preparation for an octopus merge.
func (*Repository) MergeBases ¶
func (r *Repository) MergeBases(one, two *Oid) ([]*Oid, error)
MergeBases retrieves the list of merge bases between two commits.
If none are found, an empty slice is returned and the error is set approprately
func (*Repository) MergeBasesMany ¶ added in v30.3.5
func (r *Repository) MergeBasesMany(oids []*Oid) ([]*Oid, error)
MergeBasesMany finds all merge bases given a list of commits.
func (*Repository) MergeCommits ¶
func (r *Repository) MergeCommits(ours *Commit, theirs *Commit, options *MergeOptions) (*Index, error)
func (*Repository) MergeTrees ¶
func (r *Repository) MergeTrees(ancestor *Tree, ours *Tree, theirs *Tree, options *MergeOptions) (*Index, error)
func (*Repository) Message ¶ added in v30.3.7
func (r *Repository) Message() (string, error)
Message retrieves git's prepared message. Operations such as git revert/cherry-pick/merge with the -n option stop just short of creating a commit with the changes and save their prepared message in .git/MERGE_MSG so the next git-commit execution can present it to the user for them to amend if they wish.
Use this function to get the contents of this file. Don't forget to remove the file after you create the commit.
func (*Repository) NewBranchIterator ¶
func (repo *Repository) NewBranchIterator(flags BranchType) (*BranchIterator, error)
func (*Repository) NewNoteIterator ¶
func (repo *Repository) NewNoteIterator(ref string) (*NoteIterator, error)
NewNoteIterator creates a new iterator for notes
func (*Repository) NewPackbuilder ¶
func (repo *Repository) NewPackbuilder() (*Packbuilder, error)
func (*Repository) NewRefdb ¶
func (v *Repository) NewRefdb() (refdb *Refdb, err 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) NewReferenceNameIterator ¶
func (repo *Repository) NewReferenceNameIterator() (*ReferenceNameIterator, error)
NewReferenceIterator creates a new branch iterator over reference names
func (*Repository) Odb ¶
func (v *Repository) Odb() (odb *Odb, err error)
func (*Repository) OpenRebase ¶
func (r *Repository) OpenRebase(opts *RebaseOptions) (*Rebase, error)
OpenRebase opens an existing rebase that was previously started by either an invocation of InitRebase or by another client.
func (*Repository) PatchFromBuffers ¶
func (v *Repository) PatchFromBuffers(oldPath, newPath string, oldBuf, newBuf []byte, opts *DiffOptions) (*Patch, error)
func (*Repository) Path ¶
func (repo *Repository) Path() string
func (*Repository) RemoteName ¶
func (repo *Repository) RemoteName(canonicalBranchName string) (string, error)
func (*Repository) RemoveMessage ¶ added in v30.3.7
func (r *Repository) RemoveMessage() error
RemoveMessage removes git's prepared message.
func (*Repository) ResetDefaultToCommit ¶
func (r *Repository) ResetDefaultToCommit(commit *Commit, pathspecs []string) error
func (*Repository) ResetToCommit ¶
func (r *Repository) ResetToCommit(commit *Commit, resetType ResetType, opts *CheckoutOptions) error
func (*Repository) Revert ¶
func (r *Repository) Revert(commit *Commit, revertOptions *RevertOptions) error
Revert the provided commit leaving the index updated with the results of the revert
func (*Repository) RevertCommit ¶
func (r *Repository) RevertCommit(revertCommit *Commit, ourCommit *Commit, mainline uint, mergeOptions *MergeOptions) (*Index, error)
RevertCommit reverts the provided commit against "ourCommit" The returned index contains the result of the revert and should be freed
func (*Repository) RevparseExt ¶
func (r *Repository) RevparseExt(spec string) (*Object, *Reference, error)
func (*Repository) RevparseSingle ¶
func (v *Repository) RevparseSingle(spec string) (*Object, error)
func (*Repository) SetConfig ¶ added in v30.3.9
func (v *Repository) SetConfig(c *Config) error
SetConfig sets the configuration file for this repository.
This configuration file will be used for all configuration queries involving this repository.
func (*Repository) SetHead ¶
func (v *Repository) SetHead(refname string) error
func (*Repository) SetHeadDetached ¶
func (v *Repository) SetHeadDetached(id *Oid) error
func (*Repository) SetRefdb ¶
func (v *Repository) SetRefdb(refdb *Refdb)
func (*Repository) SetWorkdir ¶
func (repo *Repository) SetWorkdir(workdir string, updateGitlink bool) error
func (*Repository) State ¶
func (r *Repository) State() RepositoryState
func (*Repository) StateCleanup ¶
func (r *Repository) StateCleanup() error
func (*Repository) StatusFile ¶
func (v *Repository) StatusFile(path string) (Status, error)
func (*Repository) StatusList ¶
func (v *Repository) StatusList(opts *StatusOptions) (*StatusList, 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 RepositoryItem ¶ added in v30.3.12
type RepositoryItem int
const ( RepositoryItemGitDir RepositoryItem = C.GIT_REPOSITORY_ITEM_GITDIR RepositoryItemWorkDir RepositoryItem = C.GIT_REPOSITORY_ITEM_WORKDIR RepositoryItemCommonDir RepositoryItem = C.GIT_REPOSITORY_ITEM_COMMONDIR RepositoryItemIndex RepositoryItem = C.GIT_REPOSITORY_ITEM_INDEX RepositoryItemObjects RepositoryItem = C.GIT_REPOSITORY_ITEM_OBJECTS RepositoryItemRefs RepositoryItem = C.GIT_REPOSITORY_ITEM_REFS RepositoryItemPackedRefs RepositoryItem = C.GIT_REPOSITORY_ITEM_PACKED_REFS RepositoryItemRemotes RepositoryItem = C.GIT_REPOSITORY_ITEM_REMOTES RepositoryItemConfig RepositoryItem = C.GIT_REPOSITORY_ITEM_CONFIG RepositoryItemInfo RepositoryItem = C.GIT_REPOSITORY_ITEM_INFO RepositoryItemHooks RepositoryItem = C.GIT_REPOSITORY_ITEM_HOOKS RepositoryItemLogs RepositoryItem = C.GIT_REPOSITORY_ITEM_LOGS RepositoryItemModules RepositoryItem = C.GIT_REPOSITORY_ITEM_MODULES RepositoryItemWorkTrees RepositoryItem = C.GIT_REPOSITORY_ITEM_WORKTREES )
type RepositoryOpenFlag ¶
type RepositoryOpenFlag int
const ( RepositoryOpenNoSearch RepositoryOpenFlag = C.GIT_REPOSITORY_OPEN_NO_SEARCH RepositoryOpenCrossFs RepositoryOpenFlag = C.GIT_REPOSITORY_OPEN_CROSS_FS RepositoryOpenBare RepositoryOpenFlag = C.GIT_REPOSITORY_OPEN_BARE RepositoryOpenFromEnv RepositoryOpenFlag = C.GIT_REPOSITORY_OPEN_FROM_ENV RepositoryOpenNoDotGit RepositoryOpenFlag = C.GIT_REPOSITORY_OPEN_NO_DOTGIT )
type RepositoryState ¶
type RepositoryState int
const ( RepositoryStateNone RepositoryState = C.GIT_REPOSITORY_STATE_NONE RepositoryStateMerge RepositoryState = C.GIT_REPOSITORY_STATE_MERGE RepositoryStateRevert RepositoryState = C.GIT_REPOSITORY_STATE_REVERT RepositoryStateCherrypick RepositoryState = C.GIT_REPOSITORY_STATE_CHERRYPICK RepositoryStateBisect RepositoryState = C.GIT_REPOSITORY_STATE_BISECT RepositoryStateRebase RepositoryState = C.GIT_REPOSITORY_STATE_REBASE RepositoryStateRebaseInteractive RepositoryState = C.GIT_REPOSITORY_STATE_REBASE_INTERACTIVE RepositoryStateRebaseMerge RepositoryState = C.GIT_REPOSITORY_STATE_REBASE_MERGE RepositoryStateApplyMailbox RepositoryState = C.GIT_REPOSITORY_STATE_APPLY_MAILBOX RepositoryStateApplyMailboxOrRebase RepositoryState = C.GIT_REPOSITORY_STATE_APPLY_MAILBOX_OR_REBASE )
type ResetType ¶
type ResetType int
const ( ResetSoft ResetType = C.GIT_RESET_SOFT ResetMixed ResetType = C.GIT_RESET_MIXED ResetHard ResetType = C.GIT_RESET_HARD )
type RevWalk ¶
type RevWalk struct {
// contains filtered or unexported fields
}
func (*RevWalk) Iterate ¶
func (v *RevWalk) Iterate(fun RevWalkIterator) (err error)
func (*RevWalk) SimplifyFirstParent ¶
func (v *RevWalk) SimplifyFirstParent()
type RevWalkIterator ¶
type RevertOptions ¶
type RevertOptions struct { Mainline uint MergeOpts MergeOptions CheckoutOpts CheckoutOptions }
RevertOptions contains options for performing a revert
func DefaultRevertOptions ¶
func DefaultRevertOptions() (RevertOptions, error)
DefaultRevertOptions initialises a RevertOptions struct with default values
type RevparseFlag ¶
type RevparseFlag int
const ( RevparseSingle RevparseFlag = C.GIT_REVPARSE_SINGLE RevparseRange RevparseFlag = C.GIT_REVPARSE_RANGE RevparseMergeBase RevparseFlag = C.GIT_REVPARSE_MERGE_BASE )
type Revspec ¶
type Revspec struct {
// contains filtered or unexported fields
}
func (*Revspec) Flags ¶
func (rs *Revspec) Flags() RevparseFlag
type SmartServiceAction ¶ added in v30.4.2
type SmartServiceAction int
SmartServiceAction is an action that the smart transport can ask a subtransport to perform.
const ( // SmartServiceActionUploadpackLs is used upon connecting to a remote, and is // used to perform reference discovery prior to performing a pull operation. SmartServiceActionUploadpackLs SmartServiceAction = C.GIT_SERVICE_UPLOADPACK_LS // SmartServiceActionUploadpack is used when performing a pull operation. SmartServiceActionUploadpack SmartServiceAction = C.GIT_SERVICE_UPLOADPACK // SmartServiceActionReceivepackLs is used upon connecting to a remote, and is // used to perform reference discovery prior to performing a push operation. SmartServiceActionReceivepackLs SmartServiceAction = C.GIT_SERVICE_RECEIVEPACK_LS // SmartServiceActionReceivepack is used when performing a push operation. SmartServiceActionReceivepack SmartServiceAction = C.GIT_SERVICE_RECEIVEPACK )
type SmartSubtransport ¶ added in v30.4.2
type SmartSubtransport interface { // Action creates a SmartSubtransportStream for the provided url and // requested action. Action(url string, action SmartServiceAction) (SmartSubtransportStream, error) // Close closes the SmartSubtransport. // // Subtransports are guaranteed a call to Close between // calls to Action, except for the following two "natural" progressions // of actions against a constant URL. // // 1. UPLOADPACK_LS -> UPLOADPACK // 2. RECEIVEPACK_LS -> RECEIVEPACK Close() error // Free releases the resources of the SmartSubtransport. Free() }
SmartSubtransport is the interface for custom subtransports which carry data for the smart transport.
type SmartSubtransportCallback ¶ added in v30.4.2
type SmartSubtransportCallback func(remote *Remote, transport *Transport) (SmartSubtransport, error)
SmartSubtransportCallback is a function which creates a new subtransport for the smart transport.
type SmartSubtransportStream ¶ added in v30.4.2
type SmartSubtransportStream interface { io.Reader io.Writer // Free releases the resources of the SmartSubtransportStream. Free() }
SmartSubtransportStream is the interface for streams used by the smart transport to read and write data from a subtransport.
type SortType ¶
type SortType uint
const ( SortNone SortType = C.GIT_SORT_NONE SortTopological SortType = C.GIT_SORT_TOPOLOGICAL SortTime SortType = C.GIT_SORT_TIME SortReverse SortType = C.GIT_SORT_REVERSE )
type StashApplyFlag ¶
type StashApplyFlag int
StashApplyFlag are flags that affect the stash apply operation.
const ( // StashApplyDefault is the default. StashApplyDefault StashApplyFlag = C.GIT_STASH_APPLY_DEFAULT // StashApplyReinstateIndex will try to reinstate not only the // working tree's changes, but also the index's changes. StashApplyReinstateIndex StashApplyFlag = C.GIT_STASH_APPLY_REINSTATE_INDEX )
type StashApplyOptions ¶
type StashApplyOptions struct { Flags StashApplyFlag CheckoutOptions CheckoutOptions // options to use when writing files to the working directory ProgressCallback StashApplyProgressCallback // optional callback to notify the consumer of application progress }
StashApplyOptions represents options to control the apply operation.
func DefaultStashApplyOptions ¶
func DefaultStashApplyOptions() (StashApplyOptions, error)
DefaultStashApplyOptions initializes the structure with default values.
type StashApplyProgress ¶
type StashApplyProgress int
StashApplyProgress are flags describing the progress of the apply operation.
const ( // StashApplyProgressNone means loading the stashed data from the object store. StashApplyProgressNone StashApplyProgress = C.GIT_STASH_APPLY_PROGRESS_NONE // StashApplyProgressLoadingStash means the stored index is being analyzed. StashApplyProgressLoadingStash StashApplyProgress = C.GIT_STASH_APPLY_PROGRESS_LOADING_STASH // StashApplyProgressAnalyzeIndex means the stored index is being analyzed. StashApplyProgressAnalyzeIndex StashApplyProgress = C.GIT_STASH_APPLY_PROGRESS_ANALYZE_INDEX // StashApplyProgressAnalyzeModified means the modified files are being analyzed. StashApplyProgressAnalyzeModified StashApplyProgress = C.GIT_STASH_APPLY_PROGRESS_ANALYZE_MODIFIED // StashApplyProgressAnalyzeUntracked means the untracked and ignored files are being analyzed. StashApplyProgressAnalyzeUntracked StashApplyProgress = C.GIT_STASH_APPLY_PROGRESS_ANALYZE_UNTRACKED // StashApplyProgressCheckoutUntracked means the untracked files are being written to disk. StashApplyProgressCheckoutUntracked StashApplyProgress = C.GIT_STASH_APPLY_PROGRESS_CHECKOUT_UNTRACKED // StashApplyProgressCheckoutModified means the modified files are being written to disk. StashApplyProgressCheckoutModified StashApplyProgress = C.GIT_STASH_APPLY_PROGRESS_CHECKOUT_MODIFIED // StashApplyProgressDone means the stash was applied successfully. StashApplyProgressDone StashApplyProgress = C.GIT_STASH_APPLY_PROGRESS_DONE )
type StashApplyProgressCallback ¶
type StashApplyProgressCallback func(progress StashApplyProgress) error
StashApplyProgressCallback is the apply operation notification callback.
type StashCallback ¶
StashCallback is called per entry when interating over all the stashed states.
'index' is the position of the current stash in the stash list, 'message' is the message used when creating the stash and 'id' is the commit id of the stash.
type StashCollection ¶
type StashCollection struct {
// contains filtered or unexported fields
}
StashCollection represents the possible operations that can be performed on the collection of stashes for a repository.
func (*StashCollection) Apply ¶
func (c *StashCollection) Apply(index int, opts StashApplyOptions) error
Apply applies a single stashed state from the stash list.
If local changes in the working directory conflict with changes in the stash then ErrorCodeConflict will be returned. In this case, the index will always remain unmodified and all files in the working directory will remain unmodified. However, if you are restoring untracked files or ignored files and there is a conflict when applying the modified files, then those files will remain in the working directory.
If passing the StashApplyReinstateIndex flag and there would be conflicts when reinstating the index, the function will return ErrorCodeConflict and both the working directory and index will be left unmodified.
Note that a minimum checkout strategy of 'CheckoutSafe' is implied.
'index' is the position within the stash list. 0 points to the most recent stashed state.
Returns error code ErrorCodeNotFound if there's no stashed state for the given index, error code ErrorCodeConflict if local changes in the working directory conflict with changes in the stash, the user returned error from the StashApplyProgressCallback, if any, or other error code.
Error codes can be interogated with IsErrorCode(err, ErrorCodeNotFound).
func (*StashCollection) Drop ¶
func (c *StashCollection) Drop(index int) error
Drop removes a single stashed state from the stash list.
'index' is the position within the stash list. 0 points to the most recent stashed state.
Returns error code ErrorCodeNotFound if there's no stashed state for the given index.
func (*StashCollection) Foreach ¶
func (c *StashCollection) Foreach(callback StashCallback) error
Foreach loops over all the stashed states and calls the callback for each one.
If callback returns an error, this will stop looping.
func (*StashCollection) Pop ¶
func (c *StashCollection) Pop(index int, opts StashApplyOptions) error
Pop applies a single stashed state from the stash list and removes it from the list if successful.
'index' is the position within the stash list. 0 points to the most recent stashed state.
'opts' controls how stashes are applied.
Returns error code ErrorCodeNotFound if there's no stashed state for the given index.
type StashFlag ¶
type StashFlag int
StashFlag are flags that affect the stash save operation.
const ( // StashDefault represents no option, default. StashDefault StashFlag = C.GIT_STASH_DEFAULT // StashKeepIndex leaves all changes already added to the // index intact in the working directory. StashKeepIndex StashFlag = C.GIT_STASH_KEEP_INDEX // StashIncludeUntracked means all untracked files are also // stashed and then cleaned up from the working directory. StashIncludeUntracked StashFlag = C.GIT_STASH_INCLUDE_UNTRACKED // StashIncludeIgnored means all ignored files are also // stashed and then cleaned up from the working directory. StashIncludeIgnored StashFlag = C.GIT_STASH_INCLUDE_IGNORED )
type Status ¶
type Status int
const ( StatusCurrent Status = C.GIT_STATUS_CURRENT StatusIndexNew Status = C.GIT_STATUS_INDEX_NEW StatusIndexModified Status = C.GIT_STATUS_INDEX_MODIFIED StatusIndexDeleted Status = C.GIT_STATUS_INDEX_DELETED StatusIndexRenamed Status = C.GIT_STATUS_INDEX_RENAMED StatusIndexTypeChange Status = C.GIT_STATUS_INDEX_TYPECHANGE StatusWtNew Status = C.GIT_STATUS_WT_NEW StatusWtModified Status = C.GIT_STATUS_WT_MODIFIED StatusWtDeleted Status = C.GIT_STATUS_WT_DELETED StatusWtTypeChange Status = C.GIT_STATUS_WT_TYPECHANGE StatusWtRenamed Status = C.GIT_STATUS_WT_RENAMED StatusIgnored Status = C.GIT_STATUS_IGNORED StatusConflicted Status = C.GIT_STATUS_CONFLICTED )
type StatusEntry ¶
type StatusList ¶
type StatusList struct {
// contains filtered or unexported fields
}
func (*StatusList) ByIndex ¶
func (statusList *StatusList) ByIndex(index int) (StatusEntry, error)
func (*StatusList) EntryCount ¶
func (statusList *StatusList) EntryCount() (int, error)
func (*StatusList) Free ¶
func (statusList *StatusList) Free()
type StatusOpt ¶
type StatusOpt int
const ( StatusOptIncludeUntracked StatusOpt = C.GIT_STATUS_OPT_INCLUDE_UNTRACKED StatusOptIncludeIgnored StatusOpt = C.GIT_STATUS_OPT_INCLUDE_IGNORED StatusOptIncludeUnmodified StatusOpt = C.GIT_STATUS_OPT_INCLUDE_UNMODIFIED StatusOptExcludeSubmodules StatusOpt = C.GIT_STATUS_OPT_EXCLUDE_SUBMODULES StatusOptRecurseUntrackedDirs StatusOpt = C.GIT_STATUS_OPT_RECURSE_UNTRACKED_DIRS StatusOptDisablePathspecMatch StatusOpt = C.GIT_STATUS_OPT_DISABLE_PATHSPEC_MATCH StatusOptRecurseIgnoredDirs StatusOpt = C.GIT_STATUS_OPT_RECURSE_IGNORED_DIRS StatusOptRenamesHeadToIndex StatusOpt = C.GIT_STATUS_OPT_RENAMES_HEAD_TO_INDEX StatusOptRenamesIndexToWorkdir StatusOpt = C.GIT_STATUS_OPT_RENAMES_INDEX_TO_WORKDIR StatusOptSortCaseSensitively StatusOpt = C.GIT_STATUS_OPT_SORT_CASE_SENSITIVELY StatusOptSortCaseInsensitively StatusOpt = C.GIT_STATUS_OPT_SORT_CASE_INSENSITIVELY StatusOptRenamesFromRewrites StatusOpt = C.GIT_STATUS_OPT_RENAMES_FROM_REWRITES StatusOptNoRefresh StatusOpt = C.GIT_STATUS_OPT_NO_REFRESH StatusOptUpdateIndex StatusOpt = C.GIT_STATUS_OPT_UPDATE_INDEX )
type StatusOptions ¶
type StatusOptions struct { Show StatusShow Flags StatusOpt Pathspec []string }
type StatusShow ¶
type StatusShow int
const ( StatusShowIndexAndWorkdir StatusShow = C.GIT_STATUS_SHOW_INDEX_AND_WORKDIR StatusShowIndexOnly StatusShow = C.GIT_STATUS_SHOW_INDEX_ONLY StatusShowWorkdirOnly StatusShow = C.GIT_STATUS_SHOW_WORKDIR_ONLY )
type Submodule ¶
type Submodule struct {
// contains filtered or unexported fields
}
Submodule
func (*Submodule) AddToIndex ¶
func (*Submodule) FetchRecurseSubmodules ¶
func (sub *Submodule) FetchRecurseSubmodules() SubmoduleRecurse
func (*Submodule) FinalizeAdd ¶
func (*Submodule) Ignore ¶
func (sub *Submodule) Ignore() SubmoduleIgnore
func (*Submodule) Open ¶
func (sub *Submodule) Open() (*Repository, error)
func (*Submodule) Update ¶
func (sub *Submodule) Update(init bool, opts *SubmoduleUpdateOptions) error
func (*Submodule) UpdateStrategy ¶
func (sub *Submodule) UpdateStrategy() SubmoduleUpdate
type SubmoduleCallback ¶ added in v30.3.0
SubmoduleCallback is a function that is called for every submodule found in SubmoduleCollection.Foreach.
type SubmoduleCbk
deprecated
type SubmoduleCbk = SubmoduleCallback
Deprecated: SubmoduleCbk is a deprecated alias of SubmoduleCallback.
type SubmoduleCollection ¶
type SubmoduleCollection struct {
// contains filtered or unexported fields
}
func (*SubmoduleCollection) Add ¶
func (c *SubmoduleCollection) Add(url, path string, use_git_link bool) (*Submodule, error)
func (*SubmoduleCollection) Foreach ¶
func (c *SubmoduleCollection) Foreach(callback SubmoduleCallback) error
func (*SubmoduleCollection) Lookup ¶
func (c *SubmoduleCollection) Lookup(name string) (*Submodule, error)
func (*SubmoduleCollection) SetFetchRecurseSubmodules ¶
func (c *SubmoduleCollection) SetFetchRecurseSubmodules(submodule string, recurse SubmoduleRecurse) error
func (*SubmoduleCollection) SetIgnore ¶
func (c *SubmoduleCollection) SetIgnore(submodule string, ignore SubmoduleIgnore) error
func (*SubmoduleCollection) SetUpdate ¶
func (c *SubmoduleCollection) SetUpdate(submodule string, update SubmoduleUpdate) error
func (*SubmoduleCollection) SetUrl ¶
func (c *SubmoduleCollection) SetUrl(submodule, url string) error
type SubmoduleIgnore ¶
type SubmoduleIgnore int
const ( SubmoduleIgnoreNone SubmoduleIgnore = C.GIT_SUBMODULE_IGNORE_NONE SubmoduleIgnoreUntracked SubmoduleIgnore = C.GIT_SUBMODULE_IGNORE_UNTRACKED SubmoduleIgnoreDirty SubmoduleIgnore = C.GIT_SUBMODULE_IGNORE_DIRTY SubmoduleIgnoreAll SubmoduleIgnore = C.GIT_SUBMODULE_IGNORE_ALL )
type SubmoduleRecurse ¶
type SubmoduleRecurse int
const ( SubmoduleRecurseNo SubmoduleRecurse = C.GIT_SUBMODULE_RECURSE_NO SubmoduleRecurseYes SubmoduleRecurse = C.GIT_SUBMODULE_RECURSE_YES SubmoduleRecurseOndemand SubmoduleRecurse = C.GIT_SUBMODULE_RECURSE_ONDEMAND )
type SubmoduleStatus ¶
type SubmoduleStatus int
const ( SubmoduleStatusInHead SubmoduleStatus = C.GIT_SUBMODULE_STATUS_IN_HEAD SubmoduleStatusInIndex SubmoduleStatus = C.GIT_SUBMODULE_STATUS_IN_INDEX SubmoduleStatusInConfig SubmoduleStatus = C.GIT_SUBMODULE_STATUS_IN_CONFIG SubmoduleStatusInWd SubmoduleStatus = C.GIT_SUBMODULE_STATUS_IN_WD SubmoduleStatusIndexAdded SubmoduleStatus = C.GIT_SUBMODULE_STATUS_INDEX_ADDED SubmoduleStatusIndexDeleted SubmoduleStatus = C.GIT_SUBMODULE_STATUS_INDEX_DELETED SubmoduleStatusIndexModified SubmoduleStatus = C.GIT_SUBMODULE_STATUS_INDEX_MODIFIED SubmoduleStatusWdUninitialized SubmoduleStatus = C.GIT_SUBMODULE_STATUS_WD_UNINITIALIZED SubmoduleStatusWdAdded SubmoduleStatus = C.GIT_SUBMODULE_STATUS_WD_ADDED SubmoduleStatusWdDeleted SubmoduleStatus = C.GIT_SUBMODULE_STATUS_WD_DELETED SubmoduleStatusWdModified SubmoduleStatus = C.GIT_SUBMODULE_STATUS_WD_MODIFIED SubmoduleStatusWdIndexModified SubmoduleStatus = C.GIT_SUBMODULE_STATUS_WD_INDEX_MODIFIED SubmoduleStatusWdWdModified SubmoduleStatus = C.GIT_SUBMODULE_STATUS_WD_WD_MODIFIED SubmoduleStatusWdUntracked SubmoduleStatus = C.GIT_SUBMODULE_STATUS_WD_UNTRACKED )
type SubmoduleUpdate ¶
type SubmoduleUpdate int
const ( SubmoduleUpdateCheckout SubmoduleUpdate = C.GIT_SUBMODULE_UPDATE_CHECKOUT SubmoduleUpdateRebase SubmoduleUpdate = C.GIT_SUBMODULE_UPDATE_REBASE SubmoduleUpdateMerge SubmoduleUpdate = C.GIT_SUBMODULE_UPDATE_MERGE SubmoduleUpdateNone SubmoduleUpdate = C.GIT_SUBMODULE_UPDATE_NONE )
type SubmoduleUpdateOptions ¶
type SubmoduleUpdateOptions struct { *CheckoutOpts *FetchOptions }
SubmoduleUpdateOptions
type Tag ¶
type Tag struct { Object // contains filtered or unexported fields }
Tag
func (*Tag) TargetType ¶
func (t *Tag) TargetType() ObjectType
type TagForeachCallback ¶
TagForeachCallback is called for each tag in the repository.
The name is the full ref name eg: "refs/tags/v1.0.0".
Note that the callback is called for lightweight tags as well, so repo.LookupTag() will return an error for these tags. Use repo.References.Lookup() instead.
type TagsCollection ¶
type TagsCollection struct {
// contains filtered or unexported fields
}
func (*TagsCollection) CreateLightweight ¶
CreateLightweight creates a new lightweight tag pointing to an object and returns the id of the target object.
The name of the tag is validated for consistency (see git_tag_create() for the rules https://libgit2.github.com/libgit2/#HEAD/group/tag/git_tag_create) and should not conflict with an already existing tag name.
If force is true and a reference already exists with the given name, it'll be replaced.
The created tag is a simple reference and can be queried using repo.References.Lookup("refs/tags/<name>"). The name of the tag (eg "v1.0.0") is queried with ref.Shorthand().
func (*TagsCollection) Foreach ¶
func (c *TagsCollection) Foreach(callback TagForeachCallback) error
Foreach calls the callback for each tag in the repository.
func (*TagsCollection) List ¶
func (c *TagsCollection) List() ([]string, error)
List returns the names of all the tags in the repository, eg: ["v1.0.1", "v2.0.0"].
func (*TagsCollection) ListWithMatch ¶
func (c *TagsCollection) ListWithMatch(pattern string) ([]string, error)
ListWithMatch returns the names of all the tags in the repository that match a given pattern.
The pattern is a standard fnmatch(3) pattern http://man7.org/linux/man-pages/man3/fnmatch.3.html
func (*TagsCollection) Remove ¶
func (c *TagsCollection) Remove(name string) error
type Trailer ¶ added in v30.0.4
Trailer represents a single git message trailer.
func MessageTrailers ¶ added in v30.0.4
MessageTrailers parses trailers out of a message, returning a slice of Trailer structs. Trailers are key/value pairs in the last paragraph of a message, not including any patches or conflicts that may be present.
type TransferProgress ¶
type TransferProgressCallback ¶
type TransferProgressCallback func(stats TransferProgress) ErrorCode
type Transport ¶ added in v30.4.2
type Transport struct {
// contains filtered or unexported fields
}
Transport encapsulates a way to communicate with a Remote.
func (*Transport) SmartCertificateCheck ¶ added in v30.4.3
func (t *Transport) SmartCertificateCheck(cert *Certificate, valid bool, hostname string) error
SmartCertificateCheck calls the certificate check for this transport.
func (*Transport) SmartCredentials ¶ added in v30.4.2
func (t *Transport) SmartCredentials(user string, methods CredentialType) (*Credential, error)
SmartCredentials calls the credentials callback for this transport.
func (*Transport) SmartProxyOptions ¶ added in v30.4.3
func (t *Transport) SmartProxyOptions() (*ProxyOptions, error)
SmartProxyOptions gets a copy of the proxy options for this transport.
type Tree ¶
type Tree struct { Object // contains filtered or unexported fields }
func (*Tree) EntryById ¶
EntryById performs a lookup for a tree entry with the given SHA value.
It returns a *TreeEntry that is owned by the Tree. You don't have to free it, but you must not use it after the Tree is freed.
Warning: this must examine every entry in the tree, so it is not fast.
func (*Tree) EntryByIndex ¶
func (*Tree) EntryByName ¶
func (*Tree) EntryByPath ¶
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 (*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 Filemode) error
func (*TreeBuilder) Remove ¶
func (v *TreeBuilder) Remove(filename string) error
func (*TreeBuilder) Write ¶
func (v *TreeBuilder) Write() (*Oid, error)
type TreeWalkCallback ¶
Source Files ¶
- Build_system_dynamic.go
- blame.go
- blob.go
- branch.go
- checkout.go
- cherrypick.go
- clone.go
- commit.go
- config.go
- credentials.go
- delta_string.go
- deprecated.go
- describe.go
- diff.go
- difflinetype_string.go
- errorclass_string.go
- errorcode_string.go
- features.go
- git.go
- graph.go
- handles.go
- http.go
- ignore.go
- index.go
- indexer.go
- mempack.go
- merge.go
- message.go
- note.go
- object.go
- odb.go
- packbuilder.go
- patch.go
- rebase.go
- refdb.go
- reference.go
- refspec.go
- remote.go
- repository.go
- reset.go
- revert.go
- revparse.go
- settings.go
- signature.go
- ssh.go
- stash.go
- status.go
- submodule.go
- tag.go
- transport.go
- tree.go
- walk.go