git2go: github.com/libgit2/git2go Index | Files

package git

import "github.com/libgit2/git2go"

Index

Package Files

blame.go blob.go branch.go checkout.go cherrypick.go clone.go commit.go config.go credentials.go describe.go diff.go features.go git.go git_dynamic.go graph.go handles.go ignore.go index.go merge.go note.go object.go odb.go packbuilder.go patch.go rebase.go refdb.go reference.go remote.go repository.go reset.go revparse.go settings.go signature.go stash.go status.go submodule.go tag.go tree.go walk.go

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
    CheckoutUserOurs                  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 (
    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
)

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

func CallbackGitTreeWalk Uses

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

export CallbackGitTreeWalk

func ConfigFindGlobal Uses

func ConfigFindGlobal() (string, error)

func ConfigFindProgramdata Uses

func ConfigFindProgramdata() (string, error)

ConfigFindProgramdata locate the path to the configuration file in ProgramData.

Look for the file in %PROGRAMDATA%\Git\config used by portable git.

func ConfigFindSystem Uses

func ConfigFindSystem() (string, error)

func ConfigFindXDG Uses

func ConfigFindXDG() (string, error)

func DiffBlobs Uses

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 Discover Uses

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

func IsErrorClass Uses

func IsErrorClass(err error, c ErrorClass) bool

func IsErrorCode Uses

func IsErrorCode(err error, c ErrorCode) bool

func MakeGitError Uses

func MakeGitError(errorCode C.int) error

func MakeGitError2 Uses

func MakeGitError2(err int) error

func MwindowMappedLimit Uses

func MwindowMappedLimit() (int, error)

func MwindowSize Uses

func MwindowSize() (int, error)

func NewCredDefault Uses

func NewCredDefault() (int, Cred)

func NewCredSshKey Uses

func NewCredSshKey(username string, publicKeyPath string, privateKeyPath string, passphrase string) (int, Cred)

NewCredSshKey creates new ssh credentials reading the public and private keys from the file system.

func NewCredSshKeyFromAgent Uses

func NewCredSshKeyFromAgent(username string) (int, Cred)

func NewCredSshKeyFromMemory Uses

func NewCredSshKeyFromMemory(username string, publicKey string, privateKey string, passphrase string) (int, Cred)

NewCredSshKeyFromMemory creates new ssh credentials using the publicKey and privateKey arguments as the values for the public and private keys.

func NewCredUserpassPlaintext Uses

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

func ReferenceIsValidName Uses

func ReferenceIsValidName(name string) bool

ReferenceIsValidName ensures 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 RemoteIsValidName Uses

func RemoteIsValidName(name string) bool

func SearchPath Uses

func SearchPath(level ConfigLevel) (string, error)

func SetMwindowMappedLimit Uses

func SetMwindowMappedLimit(size int) error

func SetMwindowSize Uses

func SetMwindowSize(size int) error

func SetSearchPath Uses

func SetSearchPath(level ConfigLevel, path string) error

func ShortenOids Uses

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

func SubmoduleStatusIsUnmodified Uses

func SubmoduleStatusIsUnmodified(status int) bool

func SubmoduleVisitor Uses

func SubmoduleVisitor(csub unsafe.Pointer, name *C.char, handle unsafe.Pointer) C.int

export SubmoduleVisitor

type AnnotatedCommit Uses

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

func (*AnnotatedCommit) Free Uses

func (mh *AnnotatedCommit) Free()

type Blame Uses

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

func (*Blame) Free Uses

func (blame *Blame) Free() error

func (*Blame) HunkByIndex Uses

func (blame *Blame) HunkByIndex(index int) (BlameHunk, error)

func (*Blame) HunkByLine Uses

func (blame *Blame) HunkByLine(lineno int) (BlameHunk, error)

func (*Blame) HunkCount Uses

func (blame *Blame) HunkCount() int

type BlameHunk Uses

type BlameHunk struct {
    LinesInHunk          uint16
    FinalCommitId        *Oid
    FinalStartLineNumber uint16
    FinalSignature       *Signature
    OrigCommitId         *Oid
    OrigPath             string
    OrigStartLineNumber  uint16
    OrigSignature        *Signature
    Boundary             bool
}

type BlameOptions Uses

type BlameOptions struct {
    Flags              BlameOptionsFlag
    MinMatchCharacters uint16
    NewestCommit       *Oid
    OldestCommit       *Oid
    MinLine            uint32
    MaxLine            uint32
}

func DefaultBlameOptions Uses

func DefaultBlameOptions() (BlameOptions, error)

type BlameOptionsFlag Uses

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
)

type Blob Uses

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

func (*Blob) AsObject Uses

func (b *Blob) AsObject() *Object

func (*Blob) Contents Uses

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

func (*Blob) Size Uses

func (v *Blob) Size() int64

type BlobCallbackData Uses

type BlobCallbackData struct {
    Callback BlobChunkCallback
    Error    error
}

type BlobChunkCallback Uses

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

type BlobWriteStream Uses

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

func (*BlobWriteStream) Commit Uses

func (stream *BlobWriteStream) Commit() (*Oid, error)

func (*BlobWriteStream) Free Uses

func (stream *BlobWriteStream) Free()

func (*BlobWriteStream) Write Uses

func (stream *BlobWriteStream) Write(p []byte) (int, error)

Implement io.Writer

type Branch Uses

type Branch struct {
    *Reference
}

func (*Branch) Delete Uses

func (b *Branch) Delete() error

func (*Branch) IsHead Uses

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

func (*Branch) Move Uses

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

func (*Branch) Name Uses

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

func (*Branch) SetUpstream Uses

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

func (*Branch) Upstream Uses

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

type BranchIterator Uses

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

func (*BranchIterator) ForEach Uses

func (i *BranchIterator) ForEach(f BranchIteratorFunc) error

func (*BranchIterator) Free Uses

func (i *BranchIterator) Free()

func (*BranchIterator) Next Uses

func (i *BranchIterator) Next() (*Branch, BranchType, error)

type BranchIteratorFunc Uses

type BranchIteratorFunc func(*Branch, BranchType) error

type BranchType Uses

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

type Certificate Uses

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 Uses

type CertificateCheckCallback func(cert *Certificate, valid bool, hostname string) ErrorCode

type CertificateKind Uses

type CertificateKind uint
const (
    CertificateX509    CertificateKind = C.GIT_CERT_X509
    CertificateHostkey CertificateKind = C.GIT_CERT_HOSTKEY_LIBSSH2
)

type CheckoutNotifyCallback Uses

type CheckoutNotifyCallback func(why CheckoutNotifyType, path string, baseline, target, workdir DiffFile) ErrorCode

type CheckoutNotifyType Uses

type CheckoutNotifyType uint

type CheckoutOpts Uses

type CheckoutOpts struct {
    Strategy         CheckoutStrategy   // Default will be a dry run
    DisableFilters   bool               // Don't apply filters like CRLF conversion
    DirMode          os.FileMode        // Default is 0755
    FileMode         os.FileMode        // Default is 0644 or 0755 as dictated by blob
    FileOpenFlags    int                // Default is O_CREAT | O_TRUNC | O_WRONLY
    NotifyFlags      CheckoutNotifyType // Default will be none
    NotifyCallback   CheckoutNotifyCallback
    ProgressCallback CheckoutProgressCallback
    TargetDirectory  string // Alternative checkout path to workdir
    Paths            []string
    Baseline         *Tree
}

type CheckoutProgressCallback Uses

type CheckoutProgressCallback func(path string, completed, total uint) ErrorCode

type CheckoutStrategy Uses

type CheckoutStrategy uint

type CherrypickOptions Uses

type CherrypickOptions struct {
    Version      uint
    Mainline     uint
    MergeOpts    MergeOptions
    CheckoutOpts CheckoutOpts
}

func DefaultCherrypickOptions Uses

func DefaultCherrypickOptions() (CherrypickOptions, error)

type CloneOptions Uses

type CloneOptions struct {
    *CheckoutOpts
    *FetchOptions
    Bare                 bool
    CheckoutBranch       string
    RemoteCreateCallback RemoteCreateCallback
}

type Commit Uses

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

Commit

func (*Commit) Amend Uses

func (c *Commit) Amend(refname string, author, committer *Signature, message string, tree *Tree) (*Oid, error)

func (*Commit) AsObject Uses

func (c *Commit) AsObject() *Object

func (*Commit) Author Uses

func (c *Commit) Author() *Signature

func (*Commit) Committer Uses

func (c *Commit) Committer() *Signature

func (*Commit) Describe Uses

func (c *Commit) Describe(opts *DescribeOptions) (*DescribeResult, error)

Describe performs the describe operation on the commit.

func (*Commit) ExtractSignature Uses

func (c *Commit) ExtractSignature() (string, string, error)

func (*Commit) Message Uses

func (c *Commit) Message() string

func (*Commit) Parent Uses

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

func (*Commit) ParentCount Uses

func (c *Commit) ParentCount() uint

func (*Commit) ParentId Uses

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

func (*Commit) RawMessage Uses

func (c *Commit) RawMessage() string

func (*Commit) Summary Uses

func (c *Commit) Summary() string

func (*Commit) Tree Uses

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

func (*Commit) TreeId Uses

func (c *Commit) TreeId() *Oid

type CompletionCallback Uses

type CompletionCallback func(RemoteCompletion) ErrorCode

type Config Uses

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

func NewConfig Uses

func NewConfig() (*Config, error)

NewConfig creates a new empty configuration object

func OpenOndisk Uses

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

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

func (*Config) AddFile Uses

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

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

func (*Config) Delete Uses

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

func (*Config) Free Uses

func (c *Config) Free()

func (*Config) LookupBool Uses

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

func (*Config) LookupInt32 Uses

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

func (*Config) LookupInt64 Uses

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

func (*Config) LookupString Uses

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

func (*Config) NewIterator Uses

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

NewIterator creates an iterator over each entry in the configuration

func (*Config) NewIteratorGlob Uses

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 Uses

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

func (*Config) OpenLevel Uses

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) SetBool Uses

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

func (*Config) SetInt32 Uses

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

func (*Config) SetInt64 Uses

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

func (*Config) SetMultivar Uses

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

func (*Config) SetString Uses

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

type ConfigEntry Uses

type ConfigEntry struct {
    Name  string
    Value string
    Level ConfigLevel
}

type ConfigIterator Uses

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

func (*ConfigIterator) Free Uses

func (iter *ConfigIterator) Free()

func (*ConfigIterator) Next Uses

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

Next returns the next entry for this iterator

type ConfigLevel Uses

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 Uses

type ConnectDirection uint

type Cred Uses

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

func (*Cred) HasUsername Uses

func (o *Cred) HasUsername() bool

func (*Cred) Type Uses

func (o *Cred) Type() CredType

type CredType Uses

type CredType uint
const (
    CredTypeUserpassPlaintext CredType = C.GIT_CREDTYPE_USERPASS_PLAINTEXT
    CredTypeSshKey            CredType = C.GIT_CREDTYPE_SSH_KEY
    CredTypeSshCustom         CredType = C.GIT_CREDTYPE_SSH_CUSTOM
    CredTypeDefault           CredType = C.GIT_CREDTYPE_DEFAULT
)

type CredentialsCallback Uses

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

type Delta Uses

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 Uses

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 Uses

func DefaultDescribeFormatOptions() (DescribeFormatOptions, error)

DefaultDescribeFormatOptions returns default options for formatting the output.

type DescribeOptions Uses

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 Uses

func DefaultDescribeOptions() (DescribeOptions, error)

DefaultDescribeOptions returns default options for the describe operation.

type DescribeOptionsStrategy Uses

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 Uses

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 Uses

func (result *DescribeResult) Format(opts *DescribeFormatOptions) (string, error)

Format prints the DescribeResult as a string.

func (*DescribeResult) Free Uses

func (result *DescribeResult) Free()

Free cleans up the C reference.

type Diff Uses

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

func (*Diff) FindSimilar Uses

func (diff *Diff) FindSimilar(opts *DiffFindOptions) error

func (*Diff) ForEach Uses

func (diff *Diff) ForEach(cbFile DiffForEachFileCallback, detail DiffDetail) error

func (*Diff) Free Uses

func (diff *Diff) Free() error

func (*Diff) GetDelta Uses

func (diff *Diff) GetDelta(index int) (DiffDelta, error)

func (*Diff) NumDeltas Uses

func (diff *Diff) NumDeltas() (int, error)

func (*Diff) Patch Uses

func (diff *Diff) Patch(deltaIndex int) (*Patch, error)

func (*Diff) Stats Uses

func (diff *Diff) Stats() (*DiffStats, error)

type DiffDelta Uses

type DiffDelta struct {
    Status     Delta
    Flags      DiffFlag
    Similarity uint16
    OldFile    DiffFile
    NewFile    DiffFile
}

type DiffDetail Uses

type DiffDetail int
const (
    DiffDetailFiles DiffDetail = iota
    DiffDetailHunks
    DiffDetailLines
)

type DiffFile Uses

type DiffFile struct {
    Path  string
    Oid   *Oid
    Size  int
    Flags DiffFlag
    Mode  uint16
}

type DiffFindOptions Uses

type DiffFindOptions struct {
    Flags                      DiffFindOptionsFlag
    RenameThreshold            uint16
    CopyThreshold              uint16
    RenameFromRewriteThreshold uint16
    BreakRewriteThreshold      uint16
    RenameLimit                uint
}

TODO implement git_diff_similarity_metric

func DefaultDiffFindOptions Uses

func DefaultDiffFindOptions() (DiffFindOptions, error)

type DiffFindOptionsFlag Uses

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 Uses

type DiffFlag int
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 Uses

type DiffForEachFileCallback func(DiffDelta, float64) (DiffForEachHunkCallback, error)

type DiffForEachHunkCallback Uses

type DiffForEachHunkCallback func(DiffHunk) (DiffForEachLineCallback, error)

type DiffForEachLineCallback Uses

type DiffForEachLineCallback func(DiffLine) error

type DiffHunk Uses

type DiffHunk struct {
    OldStart int
    OldLines int
    NewStart int
    NewLines int
    Header   string
}

type DiffLine Uses

type DiffLine struct {
    Origin    DiffLineType
    OldLineno int
    NewLineno int
    NumLines  int
    Content   string
}

type DiffLineType Uses

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
)

type DiffNotifyCallback Uses

type DiffNotifyCallback func(diffSoFar *Diff, deltaToAdd DiffDelta, matchedPathspec string) error

type DiffOptions Uses

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 Uses

func DefaultDiffOptions() (DiffOptions, error)

type DiffOptionsFlag Uses

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
    DiffIgnoreWitespaceEol     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
)

type DiffStats Uses

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

func (*DiffStats) Deletions Uses

func (stats *DiffStats) Deletions() int

func (*DiffStats) FilesChanged Uses

func (stats *DiffStats) FilesChanged() int

func (*DiffStats) Free Uses

func (stats *DiffStats) Free() error

func (*DiffStats) Insertions Uses

func (stats *DiffStats) Insertions() int

func (*DiffStats) String Uses

func (stats *DiffStats) String(format DiffStatsFormat,
    width uint) (string, error)

type DiffStatsFormat Uses

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 Uses

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 Uses

type ErrorClass int
const (
    ErrClassNone       ErrorClass = C.GITERR_NONE
    ErrClassNoMemory   ErrorClass = C.GITERR_NOMEMORY
    ErrClassOs         ErrorClass = C.GITERR_OS
    ErrClassInvalid    ErrorClass = C.GITERR_INVALID
    ErrClassReference  ErrorClass = C.GITERR_REFERENCE
    ErrClassZlib       ErrorClass = C.GITERR_ZLIB
    ErrClassRepository ErrorClass = C.GITERR_REPOSITORY
    ErrClassConfig     ErrorClass = C.GITERR_CONFIG
    ErrClassRegex      ErrorClass = C.GITERR_REGEX
    ErrClassOdb        ErrorClass = C.GITERR_ODB
    ErrClassIndex      ErrorClass = C.GITERR_INDEX
    ErrClassObject     ErrorClass = C.GITERR_OBJECT
    ErrClassNet        ErrorClass = C.GITERR_NET
    ErrClassTag        ErrorClass = C.GITERR_TAG
    ErrClassTree       ErrorClass = C.GITERR_TREE
    ErrClassIndexer    ErrorClass = C.GITERR_INDEXER
    ErrClassSSL        ErrorClass = C.GITERR_SSL
    ErrClassSubmodule  ErrorClass = C.GITERR_SUBMODULE
    ErrClassThread     ErrorClass = C.GITERR_THREAD
    ErrClassStash      ErrorClass = C.GITERR_STASH
    ErrClassCheckout   ErrorClass = C.GITERR_CHECKOUT
    ErrClassFetchHead  ErrorClass = C.GITERR_FETCHHEAD
    ErrClassMerge      ErrorClass = C.GITERR_MERGE
    ErrClassSsh        ErrorClass = C.GITERR_SSH
    ErrClassFilter     ErrorClass = C.GITERR_FILTER
    ErrClassRevert     ErrorClass = C.GITERR_REVERT
    ErrClassCallback   ErrorClass = C.GITERR_CALLBACK
    ErrClassRebase     ErrorClass = C.GITERR_REBASE
)

type ErrorCode Uses

type ErrorCode int
const (

    // No error
    ErrOk ErrorCode = C.GIT_OK

    // Generic error
    ErrGeneric ErrorCode = C.GIT_ERROR
    // Requested object could not be found
    ErrNotFound ErrorCode = C.GIT_ENOTFOUND
    // Object exists preventing operation
    ErrExists ErrorCode = C.GIT_EEXISTS
    // More than one object matches
    ErrAmbigious ErrorCode = C.GIT_EAMBIGUOUS
    // Output buffer too short to hold data
    ErrBuffs ErrorCode = C.GIT_EBUFS

    // GIT_EUSER 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.
    ErrUser ErrorCode = C.GIT_EUSER

    // Operation not allowed on bare repository
    ErrBareRepo ErrorCode = C.GIT_EBAREREPO
    // HEAD refers to branch with no commits
    ErrUnbornBranch ErrorCode = C.GIT_EUNBORNBRANCH
    // Merge in progress prevented operation
    ErrUnmerged ErrorCode = C.GIT_EUNMERGED
    // Reference was not fast-forwardable
    ErrNonFastForward ErrorCode = C.GIT_ENONFASTFORWARD
    // Name/ref spec was not in a valid format
    ErrInvalidSpec ErrorCode = C.GIT_EINVALIDSPEC
    // Checkout conflicts prevented operation
    ErrConflict ErrorCode = C.GIT_ECONFLICT
    // Lock file prevented operation
    ErrLocked ErrorCode = C.GIT_ELOCKED
    // Reference value does not match expected
    ErrModified ErrorCode = C.GIT_EMODIFIED
    // Authentication failed
    ErrAuth ErrorCode = C.GIT_EAUTH
    // Server certificate is invalid
    ErrCertificate ErrorCode = C.GIT_ECERTIFICATE
    // Patch/merge has already been applied
    ErrApplied ErrorCode = C.GIT_EAPPLIED
    // The requested peel operation is not possible
    ErrPeel ErrorCode = C.GIT_EPEEL
    // Unexpected EOF
    ErrEOF ErrorCode = C.GIT_EEOF
    // Uncommitted changes in index prevented operation
    ErrUncommitted ErrorCode = C.GIT_EUNCOMMITTED
    // The operation is not valid for a directory
    ErrDirectory ErrorCode = C.GIT_EDIRECTORY
    // A merge conflict exists and cannot continue
    ErrMergeConflict ErrorCode = C.GIT_EMERGECONFLICT

    // Internal only
    ErrPassthrough ErrorCode = C.GIT_PASSTHROUGH
    // Signals end of iteration with iterator
    ErrIterOver ErrorCode = C.GIT_ITEROVER
)

type Feature Uses

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
)

func Features Uses

func Features() Feature

Features returns a bit-flag of Feature values indicating which features the loaded libgit2 library has.

type FetchOptions Uses

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
}

type FetchPrune Uses

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 Uses

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 Uses

type GitError struct {
    Message string
    Class   ErrorClass
    Code    ErrorCode
}

func (GitError) Error Uses

func (e GitError) Error() string

type HandleList Uses

type HandleList struct {
    sync.RWMutex
    // contains filtered or unexported fields
}

func NewHandleList Uses

func NewHandleList() *HandleList

func (*HandleList) Get Uses

func (v *HandleList) Get(handle unsafe.Pointer) interface{}

Get retrieves the pointer from the given handle

func (*HandleList) Track Uses

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 Uses

func (v *HandleList) Untrack(handle unsafe.Pointer)

Untrack stops tracking the pointer given by the handle

type HostkeyCertificate Uses

type HostkeyCertificate struct {
    Kind     HostkeyKind
    HashMD5  [16]byte
    HashSHA1 [20]byte
}

Server host key information. If Kind is HostkeyMD5 the MD5 field will be filled. If Kind is HostkeySHA1, then HashSHA1 will be filled.

type HostkeyKind Uses

type HostkeyKind uint
const (
    HostkeyMD5  HostkeyKind = C.GIT_CERT_SSH_MD5
    HostkeySHA1 HostkeyKind = C.GIT_CERT_SSH_SHA1
)

type Index Uses

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

func NewIndex Uses

func NewIndex() (*Index, error)

NewIndex allocates a new index. It won't be associated with any file on the filesystem or repository

func OpenIndex Uses

func OpenIndex(path string) (*Index, error)

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 Uses

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 Uses

func (v *Index) AddAll(pathspecs []string, flags IndexAddOpts, callback IndexMatchedPathCallback) error

func (*Index) AddByPath Uses

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

func (*Index) AddConflict Uses

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

func (*Index) CleanupConflicts Uses

func (v *Index) CleanupConflicts()

FIXME: this might return an error

func (*Index) ConflictIterator Uses

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

func (*Index) EntryByIndex Uses

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

func (*Index) EntryByPath Uses

func (v *Index) EntryByPath(path string, stage int) (*IndexEntry, error)

func (*Index) EntryCount Uses

func (v *Index) EntryCount() uint

func (*Index) Find Uses

func (v *Index) Find(path string) (uint, error)

func (*Index) FindPrefix Uses

func (v *Index) FindPrefix(prefix string) (uint, error)

func (*Index) Free Uses

func (v *Index) Free()

func (*Index) GetConflict Uses

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

func (*Index) HasConflicts Uses

func (v *Index) HasConflicts() bool

func (*Index) Path Uses

func (v *Index) Path() string

Path returns the index' path on disk or an empty string if it exists only in memory.

func (*Index) ReadTree Uses

func (v *Index) ReadTree(tree *Tree) error

ReadTree replaces the contents of the index with those of the given tree

func (*Index) RemoveAll Uses

func (v *Index) RemoveAll(pathspecs []string, callback IndexMatchedPathCallback) error

func (*Index) RemoveByPath Uses

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

func (*Index) RemoveConflict Uses

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

func (*Index) RemoveDirectory Uses

func (v *Index) RemoveDirectory(dir string, stage int) error

RemoveDirectory removes all entries from the index under a given directory.

func (*Index) UpdateAll Uses

func (v *Index) UpdateAll(pathspecs []string, callback IndexMatchedPathCallback) error

func (*Index) Write Uses

func (v *Index) Write() error

func (*Index) WriteTree Uses

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

func (*Index) WriteTreeTo Uses

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

type IndexAddOpts Uses

type IndexAddOpts uint
const (
    IndexAddDefault              IndexAddOpts = C.GIT_INDEX_ADD_DEFAULT
    IndexAddForce                IndexAddOpts = C.GIT_INDEX_ADD_FORCE
    IndexAddDisablePathspecMatch IndexAddOpts = C.GIT_INDEX_ADD_DISABLE_PATHSPEC_MATCH
    IndexAddCheckPathspec        IndexAddOpts = C.GIT_INDEX_ADD_CHECK_PATHSPEC
)

type IndexConflict Uses

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

type IndexConflictIterator Uses

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

func (*IndexConflictIterator) Free Uses

func (v *IndexConflictIterator) Free()

func (*IndexConflictIterator) Index Uses

func (v *IndexConflictIterator) Index() *Index

func (*IndexConflictIterator) Next Uses

func (v *IndexConflictIterator) Next() (IndexConflict, error)

type IndexEntry Uses

type IndexEntry struct {
    Ctime IndexTime
    Mtime IndexTime
    Mode  Filemode
    Uid   uint32
    Gid   uint32
    Size  uint32
    Id    *Oid
    Path  string
}

type IndexMatchedPathCallback Uses

type IndexMatchedPathCallback func(string, string) int

type IndexStageOpts Uses

type IndexStageOpts int
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 IndexStageOpts = C.GIT_INDEX_STAGE_ANY
    // IndexStageNormal is a normal staged file in the index.
    IndexStageNormal IndexStageOpts = C.GIT_INDEX_STAGE_NORMAL
    // IndexStageAncestor is the ancestor side of a conflict.
    IndexStageAncestor IndexStageOpts = C.GIT_INDEX_STAGE_ANCESTOR
    // IndexStageOurs is the "ours" side of a conflict.
    IndexStageOurs IndexStageOpts = C.GIT_INDEX_STAGE_OURS
    // IndexStageTheirs is the "theirs" side of a conflict.
    IndexStageTheirs IndexStageOpts = C.GIT_INDEX_STAGE_THEIRS
)

type IndexTime Uses

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

type MergeAnalysis Uses

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 Uses

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 Uses

type MergeFileFlags int
const (
    MergeFileDefault MergeFileFlags = C.GIT_MERGE_FILE_DEFAULT

    MergeFileStyleMerge         MergeFileFlags = C.GIT_MERGE_FILE_STYLE_MERGE
    MergeFileStyleDiff          MergeFileFlags = C.GIT_MERGE_FILE_STYLE_DIFF3
    MergeFileStyleSimplifyAlnum MergeFileFlags = C.GIT_MERGE_FILE_SIMPLIFY_ALNUM
)

type MergeFileInput Uses

type MergeFileInput struct {
    Path     string
    Mode     uint
    Contents []byte
}

type MergeFileOptions Uses

type MergeFileOptions struct {
    AncestorLabel string
    OurLabel      string
    TheirLabel    string
    Favor         MergeFileFavor
    Flags         MergeFileFlags
}

type MergeFileResult Uses

type MergeFileResult struct {
    Automergeable bool
    Path          string
    Mode          uint
    Contents      []byte
    // contains filtered or unexported fields
}

func MergeFile Uses

func MergeFile(ancestor MergeFileInput, ours MergeFileInput, theirs MergeFileInput, options *MergeFileOptions) (*MergeFileResult, error)

func (*MergeFileResult) Free Uses

func (r *MergeFileResult) Free()

type MergeOptions Uses

type MergeOptions struct {
    Version   uint
    TreeFlags MergeTreeFlag

    RenameThreshold uint
    TargetLimit     uint
    FileFavor       MergeFileFavor
}

func DefaultMergeOptions Uses

func DefaultMergeOptions() (MergeOptions, error)

type MergePreference Uses

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 Uses

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
)

type Note Uses

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

Note

func (*Note) Author Uses

func (n *Note) Author() *Signature

Author returns the signature of the note author

func (*Note) Committer Uses

func (n *Note) Committer() *Signature

Committer returns the signature of the note committer

func (*Note) Free Uses

func (n *Note) Free() error

Free frees a git_note object

func (*Note) Id Uses

func (n *Note) Id() *Oid

Id returns the note object's id

func (*Note) Message Uses

func (n *Note) Message() string

Message returns the note message

type NoteCollection Uses

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 Uses

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 Uses

func (c *NoteCollection) DefaultRef() (string, error)

DefaultRef returns the default notes reference for a repository

func (*NoteCollection) Read Uses

func (c *NoteCollection) Read(ref string, id *Oid) (*Note, error)

Read reads the note for an object

func (*NoteCollection) Remove Uses

func (c *NoteCollection) Remove(ref string, author, committer *Signature, id *Oid) error

Remove removes the note for an object

type NoteIterator Uses

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

NoteIterator

func (*NoteIterator) Free Uses

func (v *NoteIterator) Free()

Free frees the note interator

func (*NoteIterator) Next Uses

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 Uses

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

func (*Object) AsBlob Uses

func (o *Object) AsBlob() (*Blob, error)

func (*Object) AsCommit Uses

func (o *Object) AsCommit() (*Commit, error)

func (*Object) AsTag Uses

func (o *Object) AsTag() (*Tag, error)

func (*Object) AsTree Uses

func (o *Object) AsTree() (*Tree, error)

func (*Object) Free Uses

func (o *Object) Free()

func (*Object) Id Uses

func (o *Object) Id() *Oid

func (*Object) Owner Uses

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.

func (*Object) Peel Uses

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, ErrInvalidSpec 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 ErrInvalidSpec.

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) ShortId Uses

func (o *Object) ShortId() (string, error)

func (*Object) Type Uses

func (o *Object) Type() ObjectType

type ObjectType Uses

type ObjectType int
const (
    ObjectAny    ObjectType = C.GIT_OBJ_ANY
    ObjectBad    ObjectType = C.GIT_OBJ_BAD
    ObjectCommit ObjectType = C.GIT_OBJ_COMMIT
    ObjectTree   ObjectType = C.GIT_OBJ_TREE
    ObjectBlob   ObjectType = C.GIT_OBJ_BLOB
    ObjectTag    ObjectType = C.GIT_OBJ_TAG
)

func (ObjectType) String Uses

func (t ObjectType) String() string

type Objecter Uses

type Objecter interface {
    AsObject() *Object
}

Objecter lets us accept any kind of Git object in functions.

type Odb Uses

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

func NewOdb Uses

func NewOdb() (odb *Odb, err error)

func (*Odb) AddBackend Uses

func (v *Odb) AddBackend(backend *OdbBackend, priority int) (err error)

func (*Odb) Exists Uses

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

func (*Odb) ForEach Uses

func (v *Odb) ForEach(callback OdbForEachCallback) error

func (*Odb) Free Uses

func (v *Odb) Free()

func (*Odb) Hash Uses

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 Uses

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

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

func (*Odb) NewWriteStream Uses

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) Read Uses

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

func (*Odb) ReadHeader Uses

func (v *Odb) ReadHeader(oid *Oid) (uint64, ObjectType, error)

func (*Odb) Write Uses

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

type OdbBackend Uses

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

func NewOdbBackendFromC Uses

func NewOdbBackendFromC(ptr unsafe.Pointer) (backend *OdbBackend)

func (*OdbBackend) Free Uses

func (v *OdbBackend) Free()

type OdbForEachCallback Uses

type OdbForEachCallback func(id *Oid) error

type OdbObject Uses

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

func (*OdbObject) Data Uses

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

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) Free Uses

func (v *OdbObject) Free()

func (*OdbObject) Id Uses

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

func (*OdbObject) Len Uses

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

func (*OdbObject) Type Uses

func (object *OdbObject) Type() ObjectType

type OdbReadStream Uses

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

func (*OdbReadStream) Close Uses

func (stream *OdbReadStream) Close() error

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

func (*OdbReadStream) Free Uses

func (stream *OdbReadStream) Free()

func (*OdbReadStream) Read Uses

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

Read reads from the stream

type OdbWriteStream Uses

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

func (*OdbWriteStream) Close Uses

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 Uses

func (stream *OdbWriteStream) Free()

func (*OdbWriteStream) Write Uses

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

Write writes to the stream

type Oid Uses

type Oid [20]byte

Oid represents the id for a Git object.

func NewOid Uses

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

func NewOidFromBytes Uses

func NewOidFromBytes(b []byte) *Oid

func (*Oid) Cmp Uses

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

func (*Oid) Copy Uses

func (oid *Oid) Copy() *Oid

func (*Oid) Equal Uses

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

func (*Oid) IsZero Uses

func (oid *Oid) IsZero() bool

func (*Oid) NCmp Uses

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

func (*Oid) String Uses

func (oid *Oid) String() string

type Packbuilder Uses

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

func (*Packbuilder) ForEach Uses

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 Uses

func (pb *Packbuilder) Free()

func (*Packbuilder) Insert Uses

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

func (*Packbuilder) InsertCommit Uses

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

func (*Packbuilder) InsertTree Uses

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

func (*Packbuilder) ObjectCount Uses

func (pb *Packbuilder) ObjectCount() uint32

func (*Packbuilder) Write Uses

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

func (*Packbuilder) WriteToFile Uses

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

func (*Packbuilder) Written Uses

func (pb *Packbuilder) Written() uint32

type PackbuilderForeachCallback Uses

type PackbuilderForeachCallback func([]byte) error

type PackbuilderProgressCallback Uses

type PackbuilderProgressCallback func(stage int32, current, total uint32) ErrorCode

type Patch Uses

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

func (*Patch) Free Uses

func (patch *Patch) Free() error

func (*Patch) String Uses

func (patch *Patch) String() (string, error)

type ProxyOptions Uses

type ProxyOptions struct {
    // The type of proxy to use (or none)
    Type ProxyType

    // The proxy's URL
    Url string
}

type ProxyType Uses

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 Uses

type PushOptions struct {
    // Callbacks to use for this push operation
    RemoteCallbacks RemoteCallbacks

    PbParallelism uint

    // Headers are extra headers for the push operation.
    Headers []string
}

type PushTransferProgressCallback Uses

type PushTransferProgressCallback func(current, total uint32, bytes uint) ErrorCode

type PushUpdateReferenceCallback Uses

type PushUpdateReferenceCallback func(refname, status string) ErrorCode

type Rebase Uses

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

Rebase is the struct representing a Rebase object.

func (*Rebase) Abort Uses

func (rebase *Rebase) Abort() error

Abort aborts a rebase that is currently in progress, resetting the repository and working directory to their state before rebase began.

func (*Rebase) Commit Uses

func (rebase *Rebase) Commit(ID *Oid, author, committer *Signature, message string) error

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 Uses

func (rebase *Rebase) CurrentOperationIndex() (uint, error)

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 Uses

func (rebase *Rebase) Finish() error

Finish finishes a rebase that is currently in progress once all patches have been applied.

func (*Rebase) Free Uses

func (rebase *Rebase) Free()

Free frees the Rebase object.

func (*Rebase) Next Uses

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 Uses

func (rebase *Rebase) OperationAt(index uint) *RebaseOperation

OperationAt gets the rebase operation specified by the given index.

func (*Rebase) OperationCount Uses

func (rebase *Rebase) OperationCount() uint

OperationCount gets the count of rebase operations that are to be applied.

type RebaseOperation Uses

type RebaseOperation struct {
    Type RebaseOperationType
    Id   *Oid
    Exec string
}

RebaseOperation describes a single instruction/operation to be performed during the rebase.

type RebaseOperationType Uses

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
    // 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
)

type RebaseOptions Uses

type RebaseOptions struct {
    Version         uint
    Quiet           int
    InMemory        int
    RewriteNotesRef string
    MergeOptions    MergeOptions
    CheckoutOptions CheckoutOpts
}

RebaseOptions are used to tell the rebase machinery how to operate

func DefaultRebaseOptions Uses

func DefaultRebaseOptions() (RebaseOptions, error)

DefaultRebaseOptions returns a RebaseOptions with default values.

type Refdb Uses

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

func (*Refdb) Free Uses

func (v *Refdb) Free()

func (*Refdb) SetBackend Uses

func (v *Refdb) SetBackend(backend *RefdbBackend) (err error)

type RefdbBackend Uses

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

func NewRefdbBackendFromC Uses

func NewRefdbBackendFromC(ptr unsafe.Pointer) (backend *RefdbBackend)

func (*RefdbBackend) Free Uses

func (v *RefdbBackend) Free()

type Reference Uses

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

func (*Reference) Branch Uses

func (r *Reference) Branch() *Branch

func (*Reference) Cmp Uses

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

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

func (*Reference) Delete Uses

func (v *Reference) Delete() error

func (*Reference) Free Uses

func (v *Reference) Free()

func (*Reference) IsBranch Uses

func (v *Reference) IsBranch() bool

func (*Reference) IsNote Uses

func (v *Reference) IsNote() bool

IsNote checks if the reference is a note.

func (*Reference) IsRemote Uses

func (v *Reference) IsRemote() bool

func (*Reference) IsTag Uses

func (v *Reference) IsTag() bool

func (*Reference) Name Uses

func (v *Reference) Name() string

func (*Reference) Owner Uses

func (v *Reference) Owner() *Repository

Owner returns a weak reference to the repository which owns this reference.

func (*Reference) Peel Uses

func (v *Reference) Peel(t ObjectType) (*Object, error)

func (*Reference) Rename Uses

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

func (*Reference) Resolve Uses

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

func (*Reference) SetSymbolicTarget Uses

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

func (*Reference) SetTarget Uses

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

func (*Reference) Shorthand Uses

func (v *Reference) Shorthand() string

Shorthand ret :=s a "human-readable" short reference name

func (*Reference) SymbolicTarget Uses

func (v *Reference) SymbolicTarget() string

func (*Reference) Target Uses

func (v *Reference) Target() *Oid

func (*Reference) Type Uses

func (v *Reference) Type() ReferenceType

type ReferenceCollection Uses

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

func (*ReferenceCollection) Create Uses

func (c *ReferenceCollection) Create(name string, id *Oid, force bool, msg string) (*Reference, error)

func (*ReferenceCollection) CreateSymbolic Uses

func (c *ReferenceCollection) CreateSymbolic(name, target string, force bool, msg string) (*Reference, error)

func (*ReferenceCollection) Dwim Uses

func (c *ReferenceCollection) Dwim(name string) (*Reference, error)

Dwim looks up a reference by DWIMing its short name

func (*ReferenceCollection) EnsureLog Uses

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.

func (*ReferenceCollection) HasLog Uses

func (c *ReferenceCollection) HasLog(name string) (bool, error)

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

func (*ReferenceCollection) Lookup Uses

func (c *ReferenceCollection) Lookup(name string) (*Reference, error)

type ReferenceIterator Uses

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

func (*ReferenceIterator) Free Uses

func (v *ReferenceIterator) Free()

Free the reference iterator

func (*ReferenceIterator) Names Uses

func (i *ReferenceIterator) Names() *ReferenceNameIterator

func (*ReferenceIterator) Next Uses

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

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

type ReferenceNameIterator Uses

type ReferenceNameIterator struct {
    *ReferenceIterator
}

func (*ReferenceNameIterator) Next Uses

func (v *ReferenceNameIterator) Next() (string, error)

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

type ReferenceType Uses

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

type Remote Uses

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

func (*Remote) Connect Uses

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 Uses

func (o *Remote) ConnectFetch(callbacks *RemoteCallbacks, proxyOpts *ProxyOptions, headers []string) error

func (*Remote) ConnectPush Uses

func (o *Remote) ConnectPush(callbacks *RemoteCallbacks, proxyOpts *ProxyOptions, headers []string) error

func (*Remote) Disconnect Uses

func (o *Remote) Disconnect()

func (*Remote) Fetch Uses

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 Uses

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

func (*Remote) Free Uses

func (r *Remote) Free()

func (*Remote) Ls Uses

func (o *Remote) Ls(filterRefs ...string) ([]RemoteHead, error)

func (*Remote) Name Uses

func (o *Remote) Name() string

func (*Remote) Prune Uses

func (o *Remote) Prune(callbacks *RemoteCallbacks) error

func (*Remote) PruneRefs Uses

func (o *Remote) PruneRefs() bool

func (*Remote) Push Uses

func (o *Remote) Push(refspecs []string, opts *PushOptions) error

func (*Remote) PushRefspecs Uses

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

func (*Remote) PushUrl Uses

func (o *Remote) PushUrl() string

func (*Remote) RefspecCount Uses

func (o *Remote) RefspecCount() uint

func (*Remote) Url Uses

func (o *Remote) Url() string

type RemoteCallbacks Uses

type RemoteCallbacks struct {
    SidebandProgressCallback TransportMessageCallback
    CompletionCallback
    CredentialsCallback
    TransferProgressCallback
    UpdateTipsCallback
    CertificateCheckCallback
    PackProgressCallback PackbuilderProgressCallback
    PushTransferProgressCallback
    PushUpdateReferenceCallback
}

type RemoteCollection Uses

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

func (*RemoteCollection) AddFetch Uses

func (c *RemoteCollection) AddFetch(remote, refspec string) error

func (*RemoteCollection) AddPush Uses

func (c *RemoteCollection) AddPush(remote, refspec string) error

func (*RemoteCollection) Create Uses

func (c *RemoteCollection) Create(name string, url string) (*Remote, error)

func (*RemoteCollection) CreateAnonymous Uses

func (c *RemoteCollection) CreateAnonymous(url string) (*Remote, error)

func (*RemoteCollection) CreateWithFetchspec Uses

func (c *RemoteCollection) CreateWithFetchspec(name string, url string, fetch string) (*Remote, error)

func (*RemoteCollection) Delete Uses

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

func (*RemoteCollection) List Uses

func (c *RemoteCollection) List() ([]string, error)

func (*RemoteCollection) Lookup Uses

func (c *RemoteCollection) Lookup(name string) (*Remote, error)

func (*RemoteCollection) Rename Uses

func (c *RemoteCollection) Rename(remote, newname string) ([]string, error)

func (*RemoteCollection) SetPushUrl Uses

func (c *RemoteCollection) SetPushUrl(remote, url string) error

func (*RemoteCollection) SetUrl Uses

func (c *RemoteCollection) SetUrl(remote, url string) error

type RemoteCompletion Uses

type RemoteCompletion uint

type RemoteCreateCallback Uses

type RemoteCreateCallback func(repo *Repository, name, url string) (*Remote, ErrorCode)

type RemoteHead Uses

type RemoteHead struct {
    Id   *Oid
    Name string
}

type Repository Uses

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 Uses

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

func InitRepository Uses

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

func NewRepositoryWrapOdb Uses

func NewRepositoryWrapOdb(odb *Odb) (repo *Repository, err error)

func OpenRepository Uses

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

func OpenRepositoryExtended Uses

func OpenRepositoryExtended(path string, flags RepositoryOpenFlag, ceiling string) (*Repository, error)

func (*Repository) AddGitIgnoreRules Uses

func (r *Repository) AddGitIgnoreRules(rules string) error

func (*Repository) AddIgnoreRule Uses

func (v *Repository) AddIgnoreRule(rules string) error

func (*Repository) AheadBehind Uses

func (repo *Repository) AheadBehind(local, upstream *Oid) (ahead, behind int, err error)

func (*Repository) AnnotatedCommitFromFetchHead Uses

func (r *Repository) AnnotatedCommitFromFetchHead(branchName string, remoteURL string, oid *Oid) (*AnnotatedCommit, error)

func (*Repository) AnnotatedCommitFromRef Uses

func (r *Repository) AnnotatedCommitFromRef(ref *Reference) (*AnnotatedCommit, error)

func (*Repository) BlameFile Uses

func (v *Repository) BlameFile(path string, opts *BlameOptions) (*Blame, error)

func (*Repository) CheckoutHead Uses

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

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

func (*Repository) CheckoutIndex Uses

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

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

func (*Repository) CheckoutTree Uses

func (v *Repository) CheckoutTree(tree *Tree, opts *CheckoutOpts) error

func (*Repository) Cherrypick Uses

func (v *Repository) Cherrypick(commit *Commit, opts CherrypickOptions) error

func (*Repository) ClearGitIgnoreRules Uses

func (r *Repository) ClearGitIgnoreRules() error

func (*Repository) ClearInternalIgnoreRules Uses

func (v *Repository) ClearInternalIgnoreRules() error

func (*Repository) Config Uses

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

func (*Repository) CreateBlobFromBuffer Uses

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

func (*Repository) CreateBranch Uses

func (repo *Repository) CreateBranch(branchName string, target *Commit, force bool) (*Branch, error)

func (*Repository) CreateCommit Uses

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

func (*Repository) CreateFromStream Uses

func (repo *Repository) CreateFromStream(hintPath string) (*BlobWriteStream, error)

func (*Repository) DefaultSignature Uses

func (repo *Repository) DefaultSignature() (*Signature, error)

func (*Repository) DescendantOf Uses

func (repo *Repository) DescendantOf(commit, ancestor *Oid) (bool, error)

func (*Repository) DescribeWorkdir Uses

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 Uses

func (v *Repository) DiffIndexToWorkdir(index *Index, opts *DiffOptions) (*Diff, error)

func (*Repository) DiffTreeToIndex Uses

func (v *Repository) DiffTreeToIndex(oldTree *Tree, index *Index, opts *DiffOptions) (*Diff, error)

func (*Repository) DiffTreeToTree Uses

func (v *Repository) DiffTreeToTree(oldTree, newTree *Tree, opts *DiffOptions) (*Diff, error)

func (*Repository) DiffTreeToWorkdir Uses

func (v *Repository) DiffTreeToWorkdir(oldTree *Tree, opts *DiffOptions) (*Diff, error)

func (*Repository) DiffTreeToWorkdirWithIndex Uses

func (v *Repository) DiffTreeToWorkdirWithIndex(oldTree *Tree, opts *DiffOptions) (*Diff, error)

func (*Repository) Free Uses

func (v *Repository) Free()

func (*Repository) Head Uses

func (v *Repository) Head() (*Reference, error)

func (*Repository) Index Uses

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

func (*Repository) InitRebase Uses

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 Uses

func (repo *Repository) IsBare() bool

func (*Repository) IsEmpty Uses

func (v *Repository) IsEmpty() (bool, error)

func (*Repository) IsHeadDetached Uses

func (v *Repository) IsHeadDetached() (bool, error)

func (*Repository) IsHeadUnborn Uses

func (v *Repository) IsHeadUnborn() (bool, error)

func (*Repository) IsPathIgnored Uses

func (v *Repository) IsPathIgnored(path string) (bool, error)

func (*Repository) IsShallow Uses

func (v *Repository) IsShallow() (bool, error)

func (*Repository) Lookup Uses

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

func (*Repository) LookupAnnotatedCommit Uses

func (r *Repository) LookupAnnotatedCommit(oid *Oid) (*AnnotatedCommit, error)

func (*Repository) LookupBlob Uses

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

func (*Repository) LookupBranch Uses

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

func (*Repository) LookupCommit Uses

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

func (*Repository) LookupTag Uses

func (v *Repository) LookupTag(id *Oid) (*Tag, error)

func (*Repository) LookupTree Uses

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

func (*Repository) Merge Uses

func (r *Repository) Merge(theirHeads []*AnnotatedCommit, mergeOptions *MergeOptions, checkoutOptions *CheckoutOpts) error

func (*Repository) MergeAnalysis Uses

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) MergeBase Uses

func (r *Repository) MergeBase(one *Oid, two *Oid) (*Oid, error)

func (*Repository) MergeBases Uses

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) MergeCommits Uses

func (r *Repository) MergeCommits(ours *Commit, theirs *Commit, options *MergeOptions) (*Index, error)

func (*Repository) MergeTrees Uses

func (r *Repository) MergeTrees(ancestor *Tree, ours *Tree, theirs *Tree, options *MergeOptions) (*Index, error)

func (*Repository) NewBranchIterator Uses

func (repo *Repository) NewBranchIterator(flags BranchType) (*BranchIterator, error)

func (*Repository) NewNoteIterator Uses

func (repo *Repository) NewNoteIterator(ref string) (*NoteIterator, error)

NewNoteIterator creates a new iterator for notes

func (*Repository) NewPackbuilder Uses

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

func (*Repository) NewRefdb Uses

func (v *Repository) NewRefdb() (refdb *Refdb, err error)

func (*Repository) NewReferenceIterator Uses

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

NewReferenceIterator creates a new iterator over reference names

func (*Repository) NewReferenceIteratorGlob Uses

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 Uses

func (repo *Repository) NewReferenceNameIterator() (*ReferenceNameIterator, error)

NewReferenceIterator creates a new branch iterator over reference names

func (*Repository) Odb Uses

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

func (*Repository) OpenRebase Uses

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 Uses

func (v *Repository) PatchFromBuffers(oldPath, newPath string, oldBuf, newBuf []byte, opts *DiffOptions) (*Patch, error)

func (*Repository) Path Uses

func (repo *Repository) Path() string

func (*Repository) RemoteName Uses

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

func (*Repository) ResetDefaultToCommit Uses

func (r *Repository) ResetDefaultToCommit(commit *Commit, pathspecs []string) error

func (*Repository) ResetToCommit Uses

func (r *Repository) ResetToCommit(commit *Commit, resetType ResetType, opts *CheckoutOpts) error

func (*Repository) Revparse Uses

func (r *Repository) Revparse(spec string) (*Revspec, error)

func (*Repository) RevparseExt Uses

func (r *Repository) RevparseExt(spec string) (*Object, *Reference, error)

func (*Repository) RevparseSingle Uses

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

func (*Repository) SetHead Uses

func (v *Repository) SetHead(refname string) error

func (*Repository) SetHeadDetached Uses

func (v *Repository) SetHeadDetached(id *Oid) error

func (*Repository) SetRefdb Uses

func (v *Repository) SetRefdb(refdb *Refdb)

func (*Repository) SetWorkdir Uses

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

func (*Repository) State Uses

func (r *Repository) State() RepositoryState

func (*Repository) StateCleanup Uses

func (r *Repository) StateCleanup() error

func (*Repository) StatusFile Uses

func (v *Repository) StatusFile(path string) (Status, error)

func (*Repository) StatusList Uses

func (v *Repository) StatusList(opts *StatusOptions) (*StatusList, error)

func (*Repository) TreeBuilder Uses

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

func (*Repository) TreeBuilderFromTree Uses

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

func (*Repository) UpstreamName Uses

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

func (*Repository) Walk Uses

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

func (*Repository) Workdir Uses

func (repo *Repository) Workdir() string

type RepositoryOpenFlag Uses

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 Uses

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 Uses

type ResetType int
const (
    ResetSoft  ResetType = C.GIT_RESET_SOFT
    ResetMixed ResetType = C.GIT_RESET_MIXED
    ResetHard  ResetType = C.GIT_RESET_HARD
)

type RevWalk Uses

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

func (*RevWalk) Free Uses

func (v *RevWalk) Free()

func (*RevWalk) Hide Uses

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

func (*RevWalk) HideGlob Uses

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

func (*RevWalk) HideHead Uses

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

func (*RevWalk) HideRef Uses

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

func (*RevWalk) Iterate Uses

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

func (*RevWalk) Next Uses

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

func (*RevWalk) Push Uses

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

func (*RevWalk) PushGlob Uses

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

func (*RevWalk) PushHead Uses

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

func (*RevWalk) PushRange Uses

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

func (*RevWalk) PushRef Uses

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

func (*RevWalk) Reset Uses

func (v *RevWalk) Reset()

func (*RevWalk) SimplifyFirstParent Uses

func (v *RevWalk) SimplifyFirstParent()

func (*RevWalk) Sorting Uses

func (v *RevWalk) Sorting(sm SortType)

type RevWalkIterator Uses

type RevWalkIterator func(commit *Commit) bool

type RevparseFlag Uses

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 Uses

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

func (*Revspec) Flags Uses

func (rs *Revspec) Flags() RevparseFlag

func (*Revspec) From Uses

func (rs *Revspec) From() *Object

func (*Revspec) To Uses

func (rs *Revspec) To() *Object

type Signature Uses

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

func (*Signature) Offset Uses

func (v *Signature) Offset() int

the offset in mintes, which is what git wants

type SortType Uses

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 Uses

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 Uses

type StashApplyOptions struct {
    Flags            StashApplyFlag
    CheckoutOptions  CheckoutOpts               // 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 Uses

func DefaultStashApplyOptions() (StashApplyOptions, error)

DefaultStashApplyOptions initializes the structure with default values.

type StashApplyProgress Uses

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 Uses

type StashApplyProgressCallback func(progress StashApplyProgress) error

StashApplyProgressCallback is the apply operation notification callback.

type StashCallback Uses

type StashCallback func(index int, message string, id *Oid) error

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 Uses

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 Uses

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 ErrConflict 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 ErrConflict 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 ErrNotFound if there's no stashed state for the given index, error code ErrConflict 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, ErrNotFound).

func (*StashCollection) Drop Uses

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 ErrNotFound if there's no stashed state for the given index.

func (*StashCollection) Foreach Uses

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 Uses

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 ErrNotFound if there's no stashed state for the given index.

func (*StashCollection) Save Uses

func (c *StashCollection) Save(
    stasher *Signature, message string, flags StashFlag) (*Oid, error)

Save saves the local modifications to a new stash.

Stasher is the identity of the person performing the stashing. Message is the optional description along with the stashed state. Flags control the stashing process and are given as bitwise OR.

type StashFlag Uses

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 Uses

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 Uses

type StatusEntry struct {
    Status         Status
    HeadToIndex    DiffDelta
    IndexToWorkdir DiffDelta
}

type StatusList Uses

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

func (*StatusList) ByIndex Uses

func (statusList *StatusList) ByIndex(index int) (StatusEntry, error)

func (*StatusList) EntryCount Uses

func (statusList *StatusList) EntryCount() (int, error)

func (*StatusList) Free Uses

func (statusList *StatusList) Free()

type StatusOpt Uses

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 Uses

type StatusOptions struct {
    Show     StatusShow
    Flags    StatusOpt
    Pathspec []string
}

type StatusShow Uses

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 Uses

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

Submodule

func (*Submodule) AddToIndex Uses

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

func (*Submodule) FetchRecurseSubmodules Uses

func (sub *Submodule) FetchRecurseSubmodules() SubmoduleRecurse

func (*Submodule) FinalizeAdd Uses

func (sub *Submodule) FinalizeAdd() error

func (*Submodule) Free Uses

func (sub *Submodule) Free()

func (*Submodule) HeadId Uses

func (sub *Submodule) HeadId() *Oid

func (*Submodule) Ignore Uses

func (sub *Submodule) Ignore() SubmoduleIgnore

func (*Submodule) IndexId Uses

func (sub *Submodule) IndexId() *Oid

func (*Submodule) Init Uses

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

func (*Submodule) Name Uses

func (sub *Submodule) Name() string

func (*Submodule) Open Uses

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

func (*Submodule) Path Uses

func (sub *Submodule) Path() string

func (*Submodule) Sync Uses

func (sub *Submodule) Sync() error

func (*Submodule) Update Uses

func (sub *Submodule) Update(init bool, opts *SubmoduleUpdateOptions) error

func (*Submodule) UpdateStrategy Uses

func (sub *Submodule) UpdateStrategy() SubmoduleUpdate

func (*Submodule) Url Uses

func (sub *Submodule) Url() string

func (*Submodule) WdId Uses

func (sub *Submodule) WdId() *Oid

type SubmoduleCbk Uses

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

type SubmoduleCollection Uses

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

func (*SubmoduleCollection) Add Uses

func (c *SubmoduleCollection) Add(url, path string, use_git_link bool) (*Submodule, error)

func (*SubmoduleCollection) Foreach Uses

func (c *SubmoduleCollection) Foreach(cbk SubmoduleCbk) error

func (*SubmoduleCollection) Lookup Uses

func (c *SubmoduleCollection) Lookup(name string) (*Submodule, error)

func (*SubmoduleCollection) SetFetchRecurseSubmodules Uses

func (c *SubmoduleCollection) SetFetchRecurseSubmodules(submodule string, recurse SubmoduleRecurse) error

func (*SubmoduleCollection) SetIgnore Uses

func (c *SubmoduleCollection) SetIgnore(submodule string, ignore SubmoduleIgnore) error

func (*SubmoduleCollection) SetUpdate Uses

func (c *SubmoduleCollection) SetUpdate(submodule string, update SubmoduleUpdate) error

func (*SubmoduleCollection) SetUrl Uses

func (c *SubmoduleCollection) SetUrl(submodule, url string) error

type SubmoduleIgnore Uses

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 Uses

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 Uses

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 Uses

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 Uses

type SubmoduleUpdateOptions struct {
    *CheckoutOpts
    *FetchOptions
}

SubmoduleUpdateOptions

type Tag Uses

type Tag struct {
    Object
    // contains filtered or unexported fields
}

Tag

func (*Tag) AsObject Uses

func (t *Tag) AsObject() *Object

func (Tag) Message Uses

func (t Tag) Message() string

func (Tag) Name Uses

func (t Tag) Name() string

func (Tag) Tagger Uses

func (t Tag) Tagger() *Signature

func (Tag) Target Uses

func (t Tag) Target() *Object

func (Tag) TargetId Uses

func (t Tag) TargetId() *Oid

func (Tag) TargetType Uses

func (t Tag) TargetType() ObjectType

type TagForeachCallback Uses

type TagForeachCallback func(name string, id *Oid) error

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 Uses

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

func (*TagsCollection) Create Uses

func (c *TagsCollection) Create(name string, obj Objecter, tagger *Signature, message string) (*Oid, error)

func (*TagsCollection) CreateLightweight Uses

func (c *TagsCollection) CreateLightweight(name string, obj Objecter, force bool) (*Oid, error)

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 Uses

func (c *TagsCollection) Foreach(callback TagForeachCallback) error

Foreach calls the callback for each tag in the repository.

func (*TagsCollection) List Uses

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 Uses

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 Uses

func (c *TagsCollection) Remove(name string) error

type TransferProgress Uses

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

type TransferProgressCallback Uses

type TransferProgressCallback func(stats TransferProgress) ErrorCode

type TransportMessageCallback Uses

type TransportMessageCallback func(str string) ErrorCode

type Tree Uses

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

func (*Tree) AsObject Uses

func (t *Tree) AsObject() *Object

func (Tree) EntryById Uses

func (t Tree) EntryById(id *Oid) *TreeEntry

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 Uses

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

func (Tree) EntryByName Uses

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

func (Tree) EntryByPath Uses

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

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

func (Tree) EntryCount Uses

func (t Tree) EntryCount() uint64

func (Tree) Walk Uses

func (t Tree) Walk(callback TreeWalkCallback) error

type TreeBuilder Uses

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

func (*TreeBuilder) Free Uses

func (v *TreeBuilder) Free()

func (*TreeBuilder) Insert Uses

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

func (*TreeBuilder) Remove Uses

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

func (*TreeBuilder) Write Uses

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

type TreeEntry Uses

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

type TreeWalkCallback Uses

type TreeWalkCallback func(string, *TreeEntry) int

type UpdateTipsCallback Uses

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

Package git imports 14 packages (graph) and is imported by 60 packages. Updated 2017-10-25. Refresh now. Tools for package owners.