Documentation ¶
Index ¶
- Constants
- Variables
- func FindZetaDir(cwd string) (string, string, error)
- func GetConfig(opts *GetConfigOptions) error
- func IsErrNotZetaDir(err error) bool
- func IsErrUnexpectedEOF(err error) bool
- func IsErrUnknownRevision(err error) bool
- func ListConfig(opts *ListConfigOptions) error
- func LookupAria2c() (string, error)
- func LookupDragonflyGet() (string, error)
- func ParseBool(str string) (bool, error)
- func ReferencesSort(rs References, order string) error
- func StatusName(c StatusCode) string
- func UnsetConfig(opts *UnsetConfigOptions) error
- func UpdateConfig(opts *UpdateConfigOptions) error
- type AddOptions
- type CatOptions
- type CheckIgnoreOption
- type CheckoutOptions
- type CherryPickOptions
- type CleanOptions
- type CommitOptions
- type CommitTreeOptions
- type DiffContextOptions
- type DoFetchOptions
- type ErrExitCode
- type ErrNotZetaDir
- type ErrUnknownRevision
- type FetchOptions
- type FetchResult
- type FileStatus
- type ForEachReferenceOptions
- type GcOptions
- type GetConfigOptions
- type GrepOptions
- type GrepResult
- type InitOptions
- type JsonTreeEntry
- type ListConfigOptions
- type ListFilesMode
- type LogOptions
- type LogOrder
- type LsFilesOptions
- type LsTreeOptions
- type Matcher
- type MergeOptions
- type MergeTreeOptions
- type NewOptions
- type NewTagOptions
- type OpenOptions
- type Printer
- type ProgressBar
- type PullOptions
- type PushOptions
- type RebaseMD
- type RebaseOptions
- type Reference
- type ReferenceLite
- type References
- type ReferencesEx
- type RemoteOptions
- type Repository
- func (r *Repository) Accelerator() config.Accelerator
- func (r *Repository) BaseDir() string
- func (r *Repository) Cat(ctx context.Context, opts *CatOptions) error
- func (r *Repository) CherryPick(ctx context.Context, opts *CherryPickOptions) error
- func (r *Repository) Close() error
- func (r *Repository) CommitTree(ctx context.Context, opts *CommitTreeOptions) (plumbing.Hash, error)
- func (r *Repository) ConcurrentTransfers() int
- func (r *Repository) CreateBranch(ctx context.Context, newBranch, from string, force bool, fetchMissing bool) error
- func (r *Repository) Current() (*plumbing.Reference, error)
- func (r *Repository) DbgPrint(format string, args ...any)
- func (r *Repository) Debug(format string, args ...any)
- func (r *Repository) DoFetch(ctx context.Context, opts *DoFetchOptions) (plumbing.Hash, error)
- func (r *Repository) DoUpdate(ctx context.Context, refname plumbing.ReferenceName, ...) error
- func (r *Repository) FetchObjects(ctx context.Context, commit plumbing.Hash, skipLarges bool) error
- func (r *Repository) ForEachReference(ctx context.Context, opts *ForEachReferenceOptions) error
- func (r *Repository) Gc(ctx context.Context, opts *GcOptions) error
- func (r *Repository) Grep(ctx context.Context, opts *GrepOptions) ([]GrepResult, error)
- func (r *Repository) HashTo(ctx context.Context, reader io.Reader, size int64) (oid plumbing.Hash, fragments bool, err error)
- func (r *Repository) IsAncestor(ctx context.Context, a, b string) error
- func (r *Repository) IsCurrent(refname plumbing.ReferenceName) bool
- func (r *Repository) IsExtreme() bool
- func (r *Repository) ListBranch(ctx context.Context, pattern []string) error
- func (r *Repository) ListTag(ctx context.Context, pattern []string) error
- func (r *Repository) Log(ctx context.Context, revRange string, paths []string, formatJSON bool) error
- func (r *Repository) LsTree(ctx context.Context, opts *LsTreeOptions) error
- func (r *Repository) LsTreeRecurse(ctx context.Context, opts *LsTreeOptions, t *object.Tree, m *Matcher) error
- func (r *Repository) MergeBase(ctx context.Context, revisions []string) error
- func (r *Repository) MergeTree(ctx context.Context, opts *MergeTreeOptions) error
- func (r *Repository) MoveBranch(from, to string, force bool) error
- func (r *Repository) NewCommitter() *object.Signature
- func (r *Repository) NewTag(ctx context.Context, opts *NewTagOptions) error
- func (r *Repository) ODB() *odb.ODB
- func (r *Repository) PickAncestor(ctx context.Context, oid plumbing.Hash, n int) (plumbing.Hash, error)
- func (r *Repository) Postflight(ctx context.Context) error
- func (r *Repository) Push(ctx context.Context, o *PushOptions) error
- func (r *Repository) RDB() refs.Backend
- func (r *Repository) ReferenceExists(ctx context.Context, refname string) error
- func (r *Repository) ReferenceResolve(name plumbing.ReferenceName) (ref *plumbing.Reference, err error)
- func (r *Repository) ReferencesEx(ctx context.Context) (*ReferencesEx, error)
- func (r *Repository) RemoveBranch(branches []string, force bool) error
- func (r *Repository) RemoveTag(tags []string) error
- func (r *Repository) Revision(ctx context.Context, branchOrTag string) (plumbing.Hash, error)
- func (r *Repository) RevisionEx(ctx context.Context, revision string) (plumbing.Hash, plumbing.ReferenceName, error)
- func (r *Repository) ShowCurrent(w io.Writer) error
- func (r *Repository) SwitchBranch(ctx context.Context, branch string, so *SwitchOptions) error
- func (r *Repository) SwitchDetach(ctx context.Context, basePoint string, so *SwitchOptions) error
- func (r *Repository) SwitchNewBranch(ctx context.Context, newBranch string, basePoint string, so *SwitchOptions) error
- func (r *Repository) SwitchOrphan(ctx context.Context, newBranch string, so *SwitchOptions) error
- func (r *Repository) Worktree() *Worktree
- func (r *Repository) WriteEncoded(e object.Encoder) (oid plumbing.Hash, err error)
- func (r *Repository) ZetaDir() string
- type ResetMode
- type ResetOptions
- type RestoreOptions
- type ShowReferenceOptions
- type StageItem
- type StashPushOptions
- type Status
- type StatusCode
- type StringArray
- type SwitchOptions
- type UnsetConfigOptions
- type UpdateConfigOptions
- type Worktree
- func (w *Worktree) Add(ctx context.Context, pathSpec []string, dryRun bool) error
- func (w *Worktree) AddGlob(ctx context.Context, pattern string, dryRun bool) error
- func (w *Worktree) AddTracked(ctx context.Context, pathSpec []string, dryRun bool) error
- func (w *Worktree) AddWithOptions(ctx context.Context, opts *AddOptions) error
- func (w *Worktree) Checkout(ctx context.Context, opts *CheckoutOptions) error
- func (w *Worktree) Chmod(ctx context.Context, paths []string, mask bool, dryRun bool) error
- func (w *Worktree) Clean(ctx context.Context, opts *CleanOptions) error
- func (w *Worktree) Commit(ctx context.Context, opts *CommitOptions) (plumbing.Hash, error)
- func (w *Worktree) DiffContext(ctx context.Context, opts *DiffContextOptions, writer io.Writer) error
- func (w *Worktree) DiffTreeWithIndex(ctx context.Context, oid plumbing.Hash, opts *DiffContextOptions, ...) error
- func (w *Worktree) DiffTreeWithWorktree(ctx context.Context, oid plumbing.Hash, opts *DiffContextOptions, ...) error
- func (w *Worktree) DoBatchCo(ctx context.Context, oneByOne bool, revision string, r io.Reader) error
- func (w *Worktree) DoCheckIgnore(ctx context.Context, opts *CheckIgnoreOption) error
- func (w *Worktree) DoPathCo(ctx context.Context, worktreeOnly bool, oid plumbing.Hash, pathSpec []string) error
- func (w *Worktree) Grep(ctx context.Context, opts *GrepOptions) ([]GrepResult, error)
- func (w *Worktree) LsFiles(ctx context.Context, opts *LsFilesOptions) error
- func (w *Worktree) Merge(ctx context.Context, opts *MergeOptions) error
- func (w *Worktree) Pull(ctx context.Context, opts *PullOptions) error
- func (w *Worktree) Rebase(ctx context.Context, opts *RebaseOptions) error
- func (w *Worktree) Remove(ctx context.Context, patterns []string, opts *RemoteOptions) error
- func (w *Worktree) RemoveGlob(pattern string) error
- func (w *Worktree) RemoveLegecy(path string) (plumbing.Hash, error)
- func (w *Worktree) Reset(ctx context.Context, opts *ResetOptions) error
- func (w *Worktree) ResetSparsely(ctx context.Context, opts *ResetOptions, bar ProgressBar) error
- func (w *Worktree) ResetSpec(ctx context.Context, oid plumbing.Hash, pathSpec []string) error
- func (w *Worktree) Restore(ctx context.Context, opts *RestoreOptions) error
- func (w *Worktree) ShowStatus(status Status, short bool, z bool)
- func (w *Worktree) StashApply(ctx context.Context, stashRev string) error
- func (w *Worktree) StashClear(ctx context.Context) error
- func (w *Worktree) StashDrop(ctx context.Context, stashRev string) error
- func (w *Worktree) StashList(ctx context.Context) error
- func (w *Worktree) StashPop(ctx context.Context, stashRev string) error
- func (w *Worktree) StashPush(ctx context.Context, opts *StashPushOptions) error
- func (w *Worktree) StashShow(ctx context.Context, stashRev string) error
- func (w *Worktree) Stats(ctx context.Context) error
- func (w *Worktree) Status(ctx context.Context, verbose bool) (Status, error)
Constants ¶
const ( COMMIT_EDITMSG = "COMMIT_EDITMSG" TAG_EDITMSG = "TAG_EDITMSG" MERGE_MSG = "MERGE_MSG" )
const ( NoSizeLimit = -1 NoDepth = 0 NoDeepen = 0 AnyDeepen = -1 )
const ( ENV_ZETA_CORE_ACCELERATOR = "ZETA_CORE_ACCELERATOR" ENV_ZETA_CORE_OPTIMIZE_STRATEGY = "ZETA_CORE_OPTIMIZE_STRATEGY" ENV_ZETA_CORE_CONCURRENT_TRANSFERS = "ZETA_CORE_CONCURRENT_TRANSFERS" ENV_ZETA_CORE_SHARING_ROOT = "ZETA_CORE_SHARING_ROOT" ENV_ZETA_CORE_PROMISOR = "ZETA_CORE_PROMISOR" ENV_ZETA_AUTHOR_NAME = "ZETA_AUTHOR_NAME" ENV_ZETA_AUTHOR_EMAIL = "ZETA_AUTHOR_EMAIL" ENV_ZETA_AUTHOR_DATE = "ZETA_AUTHOR_DATE" ENV_ZETA_COMMITTER_NAME = "ZETA_COMMITTER_NAME" ENV_ZETA_COMMITTER_EMAIL = "ZETA_COMMITTER_EMAIL" ENV_ZETA_COMMITTER_DATE = "ZETA_COMMITTER_DATE" ENV_ZETA_MERGE_TEXT_DRIVER = "ZETA_MERGE_TEXT_DRIVER" ENV_ZETA_EDITOR = "ZETA_EDITOR" ENV_ZETA_SSL_NO_VERIFY = "ZETA_SSL_NO_VERIFY" ENV_ZETA_TRANSPORT_MAX_ENTRIES = "ZETA_TRANSPORT_MAX_ENTRIES" ENV_ZETA_TRANSPORT_LARGE_SIZE = "ZETA_TRANSPORT_LARGE_SIZE" )
const (
ENV_ZETA_EXTENSION_ARIA2C = "ZETA_EXTENSION_ARIA2C"
)
const (
ENV_ZETA_EXTENSION_DRAGONFLY_GET = "ZETA_EXTENSION_DRAGONFLY_GET"
)
const (
NUL = '\x00'
)
const (
REBASE_MD = "REBASE-MD"
)
const (
StashName plumbing.ReferenceName = "refs/stash"
)
const (
// ZetaDirName this is a special folder where all the zeta stuff is.
ZetaDirName = ".zeta"
)
Variables ¶
var ( ErrMissingKeys = errors.New("missing keys") ErrOnlyOneName = errors.New("only one config file at a time") )
var ( ErrHasConflicts = errors.New("merge: there are conflicting files") ErrNotAncestor = errors.New("merge-base: not ancestor") )
var ( ErrBranchHashExclusive = errors.New("branch and Hash are mutually exclusive") ErrCreateRequiresBranch = errors.New("branch is mandatory when Create is used") )
var ( ErrWorktreeNotEmpty = errors.New("worktree not empty") ErrWorktreeNotClean = errors.New("worktree is not clean") ErrUnstagedChanges = errors.New("worktree contains unstaged changes") ErrNonFastForwardUpdate = errors.New("non-fast-forward update") )
var ( ErrNotTreeNoder = errors.New("not tree noder") ErrNotIndexNode = errors.New("not index node") )
var ( // ErrNoChanges occurs when a commit is attempted using a clean // working tree, with no changes to be committed. ErrNoChanges = errors.New("clean working tree") ErrNotAllowEmptyMessage = errors.New("not allow empty message") ErrNothingToCommit = errors.New("nothing to commit") )
var ( // ErrDestinationExists in an Move operation means that the target exists on // the worktree. ErrDestinationExists = errors.New("destination exists") // ErrGlobNoMatches in an AddGlob if the glob pattern does not match any // files in the worktree. ErrGlobNoMatches = errors.New("glob pattern did not match any files") )
var (
ErrAborting = errors.New("aborting")
)
var (
ErrHasUnstaged = errors.New("has unstaged")
)
var (
ErrHashOrReference = errors.New("ambiguous options, only one of CommitHash or ReferenceName can be passed")
)
var (
ErrHaveCommits = errors.New("have commits")
)
var (
ErrMissingAuthor = errors.New("author field is required")
)
var (
ErrNotAStashLikeCommit = errors.New("not a stash-like commit")
)
var (
ErrNotAllowedRemoveCurrent = errors.New("not allowed remove HEAD")
)
var (
ErrPushRejected = errors.New("push rejected")
)
var (
W = tr.W // translate func wrap
)
Functions ¶
func FindZetaDir ¶
FindZetaDir return worktreeDir, zetaDir, err
func GetConfig ¶
func GetConfig(opts *GetConfigOptions) error
func IsErrNotZetaDir ¶
func IsErrUnexpectedEOF ¶
func IsErrUnknownRevision ¶
func ListConfig ¶
func ListConfig(opts *ListConfigOptions) error
func LookupAria2c ¶
func LookupDragonflyGet ¶
func ParseBool ¶
ParseBool returns the boolean value represented by the string. It accepts 1, t, T, TRUE, true, True, 0, f, F, FALSE, false, False. Any other value returns an error.
func ReferencesSort ¶
func ReferencesSort(rs References, order string) error
objectsize authordate committerdate creatordate taggerdate
func StatusName ¶
func StatusName(c StatusCode) string
func UnsetConfig ¶
func UnsetConfig(opts *UnsetConfigOptions) error
func UpdateConfig ¶
func UpdateConfig(opts *UpdateConfigOptions) error
Types ¶
type AddOptions ¶
type AddOptions struct { // All equivalent to `git add -A`, update the index not only where the // working tree has a file matching `Path` but also where the index already // has an entry. This adds, modifies, and removes index entries to match the // working tree. If no `Path` nor `Glob` is given when `All` option is // used, all files in the entire working tree are updated. All bool // Path is the exact filepath to the file or directory to be added. Path string // Glob adds all paths, matching pattern, to the index. If pattern matches a // directory path, all directory contents are added to the index recursively. Glob string // SkipStatus adds the path with no status check. This option is relevant only // when the `Path` option is specified and does not apply when the `All` option is used. // Notice that when passing an ignored path it will be added anyway. // When true it can speed up adding files to the worktree in very large repositories. SkipStatus bool DryRun bool }
AddOptions describes how an `add` operation should be performed
func (*AddOptions) Validate ¶
func (o *AddOptions) Validate(r *Repository) error
Validate validates the fields and sets the default values.
type CatOptions ¶
type CheckIgnoreOption ¶
type CheckoutOptions ¶
type CheckoutOptions struct { // Hash is the hash of the commit to be checked out. If used, HEAD will be // in detached mode. If Create is not used, Branch and Hash are mutually // exclusive. Hash plumbing.Hash // Branch to be checked out, if Branch and Hash are empty is set to `master`. Branch plumbing.ReferenceName // Create a new branch named Branch and start it at Hash. Create bool Force bool Merge bool First bool One bool Quiet bool }
CheckoutOptions describes how a checkout operation should be performed.
func (*CheckoutOptions) Validate ¶
func (o *CheckoutOptions) Validate() error
Validate validates the fields and sets the default values.
type CherryPickOptions ¶
type CleanOptions ¶
type CleanOptions struct { // dry run DryRun bool // Dir recurses into nested directories. Dir bool // All removes all changes, even those excluded by gitignore. All bool }
CleanOptions describes how a clean should be performed.
type CommitOptions ¶
type CommitOptions struct { // All automatically stage files that have been modified and deleted, but // new files you have not told Git about are not affected. All bool // AllowEmptyCommits enable empty commits to be created. An empty commit // is when no changes to the tree were made, but a new commit message is // provided. The default behavior is false, which results in ErrEmptyCommit. AllowEmptyCommits bool // Author is the author's signature of the commit. If Author is empty the // Name and Email is read from the config, and time.Now it's used as When. Author object.Signature // Committer is the committer's signature of the commit. If Committer is // nil the Author signature is used. Committer object.Signature // Parents are the parents commits for the new commit, by default when // len(Parents) is zero, the hash of HEAD reference is used. Parents []plumbing.Hash // SignKey denotes a key to sign the commit with. A nil value here means the // commit will not be signed. The private key must be present and already // decrypted. SignKey *openpgp.Entity // Amend will create a new commit object and replace the commit that HEAD currently // points to. Cannot be used with All nor Parents. Amend bool AllowEmptyMessage bool Message []string File string }
CommitOptions describes how a commit operation should be performed.
func (*CommitOptions) Validate ¶
func (o *CommitOptions) Validate(r *Repository) error
Validate validates the fields and sets the default values.
type CommitTreeOptions ¶
type CommitTreeOptions struct { Tree plumbing.Hash // Author is the author's signature of the commit. If Author is empty the // Name and Email is read from the config, and time.Now it's used as When. Author object.Signature // Committer is the committer's signature of the commit. If Committer is // nil the Author signature is used. Committer object.Signature // Parents are the parents commits for the new commit, by default when // len(Parents) is zero, the hash of HEAD reference is used. Parents []plumbing.Hash // SignKey denotes a key to sign the commit with. A nil value here means the // commit will not be signed. The private key must be present and already // decrypted. SignKey *openpgp.Entity // Amend will create a new commit object and replace the commit that HEAD currently // points to. Cannot be used with All nor Parents. Message string }
type DiffContextOptions ¶
type DiffContextOptions struct { NameOnly bool NameStatus bool // name status NumStat bool Stat bool ShortStat bool Staged bool NewLine byte MergeBase string From string To string PathSpec []string Textconv bool UseColor bool ThreeWayCompare bool }
func (*DiffContextOptions) PatchContext ¶
type DoFetchOptions ¶
type DoFetchOptions struct { Name string Unshallow bool Limit int64 Tag bool Force bool FetchAlways bool SkipLarges bool }
func (*DoFetchOptions) ReferenceName ¶
func (opts *DoFetchOptions) ReferenceName() plumbing.ReferenceName
type ErrExitCode ¶
func (*ErrExitCode) Error ¶
func (e *ErrExitCode) Error() string
type ErrNotZetaDir ¶
type ErrNotZetaDir struct {
// contains filtered or unexported fields
}
ErrNotExist commit not exist error
func (*ErrNotZetaDir) Error ¶
func (err *ErrNotZetaDir) Error() string
type ErrUnknownRevision ¶
type ErrUnknownRevision struct {
// contains filtered or unexported fields
}
func (*ErrUnknownRevision) Error ¶
func (e *ErrUnknownRevision) Error() string
type FetchOptions ¶
type FileStatus ¶
type FileStatus struct { // Staging is the status of a file in the staging area Staging StatusCode // Worktree is the status of a file in the worktree Worktree StatusCode // Extra contains extra information, such as the previous name in a rename Extra string }
FileStatus contains the status of a file in the worktree
type ForEachReferenceOptions ¶
type GetConfigOptions ¶
type GrepOptions ¶
type GrepOptions struct { // Patterns are compiled Regexp objects to be matched. Patterns []*regexp.Regexp // InvertMatch selects non-matching lines. InvertMatch bool // CommitHash is the hash of the commit from which worktree should be derived. CommitHash plumbing.Hash // ReferenceName is the branch or tag name from which worktree should be derived. ReferenceName plumbing.ReferenceName // PathSpecs are compiled Regexp objects of pathspec to use in the matching. PathSpecs []*regexp.Regexp // Size Limit Limit int64 }
GrepOptions describes how a grep should be performed.
func (*GrepOptions) Validate ¶
func (o *GrepOptions) Validate(w *Worktree) error
Validate validates the fields and sets the default values.
TODO: deprecate in favor of Validate(r *Repository) in v6.
type GrepResult ¶
type GrepResult struct { // FileName is the name of file which contains match. FileName string // LineNumber is the line number of a file at which a match was found. LineNumber int // Content is the content of the file at the matching line. Content string // TreeName is the name of the tree (reference name/commit hash) at // which the match was performed. TreeName string }
GrepResult is structure of a grep result.
func (GrepResult) String ¶
func (gr GrepResult) String() string
type InitOptions ¶
type JsonTreeEntry ¶
type ListConfigOptions ¶
type ListFilesMode ¶
type ListFilesMode int
const ( ListFilesCached ListFilesMode = iota ListFilesDeleted ListFilesModified ListFilesOthers //ListFilesIgnored ListFilesStage )
type LogOptions ¶
type LogOptions struct { // When the From option is set the log will only contain commits // reachable from it. If this option is not set, HEAD will be used as // the default From. From plumbing.Hash // The default traversal algorithm is Depth-first search // set Order=LogOrderCommitterTime for ordering by committer time (more compatible with `git log`) // set Order=LogOrderBSF for Breadth-first search Order LogOrder // Show only those commits in which the specified file was inserted/updated. // It is equivalent to running `zeta log -- <file-name>`. // this field is kept for compatibility, it can be replaced with PathFilter FileName *string // Filter commits based on the path of files that are updated // takes file path as argument and should return true if the file is desired // It can be used to implement `zeta log -- <path>` // either <path> is a file path, or directory path, or a regexp of file/directory path PathFilter func(string) bool // Pretend as if all the refs in refs/, along with HEAD, are listed on the command line as <commit>. // It is equivalent to running `zeta log --all`. // If set on true, the From option will be ignored. All bool // Show commits more recent than a specific date. // It is equivalent to running `zeta log --since <date>` or `zeta log --after <date>`. Since *time.Time // Show commits older than a specific date. // It is equivalent to running `zeta log --until <date>` or `zeta log --before <date>`. Until *time.Time }
LogOptions describes how a log action should be performed.
type LsFilesOptions ¶
type LsFilesOptions struct { Mode ListFilesMode Z bool JSON bool Paths []string }
type LsTreeOptions ¶
type LsTreeOptions struct { OnlyTrees bool Recurse bool Tree bool NewLine byte Long bool NameOnly bool Abbrev int Revision string Paths []string JSON bool }
func (*LsTreeOptions) Rev ¶
func (opts *LsTreeOptions) Rev() string
type MergeOptions ¶
type MergeOptions struct { From string // From branch // Requires a merge to be fast forward only. If this is true, then a merge will // throw an error if ff is not possible. FFOnly bool FF bool Squash bool Signoff bool
MergeOptions describes how a merge should be erformed
type MergeTreeOptions ¶
type MergeTreeOptions struct {
Branch1, Branch2, MergeBase string
type NewOptions ¶
type NewOptions struct { Remote string Branch string TagName string Commit string Destination string Depth int SparseDirs []string Snapshot bool SizeLimit int64 Values []string One bool Quiet bool Verbose bool }
func (*NewOptions) Validate ¶
func (opts *NewOptions) Validate() error
type NewTagOptions ¶
type OpenOptions ¶
type Printer ¶
type Printer struct {
// contains filtered or unexported fields
}
func NewPrinter ¶
type ProgressBar ¶
type ProgressBar interface {
Add(int)
}
type PullOptions ¶
type PushOptions ¶
type PushOptions struct { // Refspece: eg: // // zeta push dev // update branch or tag // zeta push :dev // delete branch or tag // zeta push rev:dev // update reference to rev // zeta push // update current branch Refspec string PushObjects []string Tag bool Force bool }
func (*PushOptions) Target ¶
func (o *PushOptions) Target(name string) plumbing.ReferenceName
type RebaseMD ¶
type RebaseMD struct { REBASE_HEAD plumbing.Hash `toml:"REBASE_HEAD"` // REBASE_HEAD ONTO plumbing.Hash `toml:"ONTO"` // ONTO Hash STOPPED plumbing.Hash `toml:"STOPPED"` // STOPPED Hash LAST plumbing.Hash `toml:"LAST"` // LAST MERGE_TREE plumbing.Hash `toml:"MERGE_TREE"` // MERGE_TREE HEAD plumbing.ReferenceName `toml:"HEAD"` // HEAD aka CURRENT }
type RebaseOptions ¶
type Reference ¶
type Reference struct { Name plumbing.ReferenceName `json:"refname"` ShortName string `json:"refname_short"` Hash plumbing.Hash `json:"objectname"` // object name : commit/tag object ... Size int `json:"objectsize"` Type string `json:"objecttype"` Target *object.Commit `json:"commit,omitempty"` Tag *object.Tag `json:"tag,omitempty"` IsCurrent bool `json:"head,omitempty"` }
type ReferenceLite ¶
type ReferenceLite struct { Name plumbing.ReferenceName ShortName plumbing.ReferenceName Target plumbing.ReferenceName }
type References ¶
type References []*Reference
type ReferencesEx ¶
type ReferencesEx struct { *refs.DB M map[plumbing.Hash][]*ReferenceLite }
type Repository ¶
func Init ¶
func Init(ctx context.Context, opts *InitOptions) (*Repository, error)
func New ¶
func New(ctx context.Context, opts *NewOptions) (*Repository, error)
create a new repo using zeta checkout command
func Open ¶
func Open(ctx context.Context, opts *OpenOptions) (*Repository, error)
func (*Repository) Accelerator ¶
func (r *Repository) Accelerator() config.Accelerator
func (*Repository) BaseDir ¶
func (r *Repository) BaseDir() string
func (*Repository) Cat ¶
func (r *Repository) Cat(ctx context.Context, opts *CatOptions) error
func (*Repository) CherryPick ¶
func (r *Repository) CherryPick(ctx context.Context, opts *CherryPickOptions) error
func (*Repository) Close ¶
func (r *Repository) Close() error
func (*Repository) CommitTree ¶
func (r *Repository) CommitTree(ctx context.Context, opts *CommitTreeOptions) (plumbing.Hash, error)
func (*Repository) ConcurrentTransfers ¶
func (r *Repository) ConcurrentTransfers() int
func (*Repository) CreateBranch ¶
func (*Repository) DbgPrint ¶
func (r *Repository) DbgPrint(format string, args ...any)
func (*Repository) Debug ¶
func (r *Repository) Debug(format string, args ...any)
func (*Repository) DoFetch ¶
func (r *Repository) DoFetch(ctx context.Context, opts *DoFetchOptions) (plumbing.Hash, error)
DoFetch: Fetch reference or commit
func (*Repository) DoUpdate ¶
func (r *Repository) DoUpdate(ctx context.Context, refname plumbing.ReferenceName, oldRev, newRev plumbing.Hash, committer *object.Signature, message string) error
DoUpdate: update-ref
func (*Repository) FetchObjects ¶
func (*Repository) ForEachReference ¶
func (r *Repository) ForEachReference(ctx context.Context, opts *ForEachReferenceOptions) error
func (*Repository) Grep ¶
func (r *Repository) Grep(ctx context.Context, opts *GrepOptions) ([]GrepResult, error)
Grep performs grep on a repository.
func (*Repository) IsAncestor ¶
func (r *Repository) IsAncestor(ctx context.Context, a, b string) error
func (*Repository) IsCurrent ¶
func (r *Repository) IsCurrent(refname plumbing.ReferenceName) bool
func (*Repository) IsExtreme ¶
func (r *Repository) IsExtreme() bool
func (*Repository) ListBranch ¶
func (r *Repository) ListBranch(ctx context.Context, pattern []string) error
func (*Repository) ListTag ¶
func (r *Repository) ListTag(ctx context.Context, pattern []string) error
func (*Repository) LsTree ¶
func (r *Repository) LsTree(ctx context.Context, opts *LsTreeOptions) error
func (*Repository) LsTreeRecurse ¶
func (r *Repository) LsTreeRecurse(ctx context.Context, opts *LsTreeOptions, t *object.Tree, m *Matcher) error
func (*Repository) MergeBase ¶
func (r *Repository) MergeBase(ctx context.Context, revisions []string) error
func (*Repository) MergeTree ¶
func (r *Repository) MergeTree(ctx context.Context, opts *MergeTreeOptions) error
func (*Repository) MoveBranch ¶
func (r *Repository) MoveBranch(from, to string, force bool) error
func (*Repository) NewCommitter ¶
func (r *Repository) NewCommitter() *object.Signature
func (*Repository) NewTag ¶
func (r *Repository) NewTag(ctx context.Context, opts *NewTagOptions) error
func (*Repository) ODB ¶
func (r *Repository) ODB() *odb.ODB
func (*Repository) PickAncestor ¶
func (*Repository) Postflight ¶
func (r *Repository) Postflight(ctx context.Context) error
func (*Repository) Push ¶
func (r *Repository) Push(ctx context.Context, o *PushOptions) error
func (*Repository) RDB ¶
func (r *Repository) RDB() refs.Backend
func (*Repository) ReferenceExists ¶
func (r *Repository) ReferenceExists(ctx context.Context, refname string) error
func (*Repository) ReferenceResolve ¶
func (r *Repository) ReferenceResolve(name plumbing.ReferenceName) (ref *plumbing.Reference, err error)
func (*Repository) ReferencesEx ¶
func (r *Repository) ReferencesEx(ctx context.Context) (*ReferencesEx, error)
func (*Repository) RemoveBranch ¶
func (r *Repository) RemoveBranch(branches []string, force bool) error
func (*Repository) RemoveTag ¶
func (r *Repository) RemoveTag(tags []string) error
func (*Repository) Revision ¶
Revision resolve revision
https://git-scm.com/book/en/v2/Git-Tools-Revision-Selection We are not strictly compatible with Git, do not support combination mode, and do not support finding the second parent
eg: HEAD HEAD^^^^ HEAD~2 BRANCH or TAG Long-OID Short-OID
func (*Repository) RevisionEx ¶
func (r *Repository) RevisionEx(ctx context.Context, revision string) (plumbing.Hash, plumbing.ReferenceName, error)
func (*Repository) ShowCurrent ¶
func (r *Repository) ShowCurrent(w io.Writer) error
func (*Repository) SwitchBranch ¶
func (r *Repository) SwitchBranch(ctx context.Context, branch string, so *SwitchOptions) error
func (*Repository) SwitchDetach ¶
func (r *Repository) SwitchDetach(ctx context.Context, basePoint string, so *SwitchOptions) error
func (*Repository) SwitchNewBranch ¶
func (r *Repository) SwitchNewBranch(ctx context.Context, newBranch string, basePoint string, so *SwitchOptions) error
func (*Repository) SwitchOrphan ¶
func (r *Repository) SwitchOrphan(ctx context.Context, newBranch string, so *SwitchOptions) error
func (*Repository) Worktree ¶
func (r *Repository) Worktree() *Worktree
func (*Repository) WriteEncoded ¶
func (*Repository) ZetaDir ¶
func (r *Repository) ZetaDir() string
type ResetMode ¶
type ResetMode int8
ResetMode defines the mode of a reset operation.
const ( // MixedReset resets the index but not the working tree (i.e., the changed // files are preserved but not marked for commit) and reports what has not // been updated. This is the default action. MixedReset ResetMode = iota // HardReset resets the index and working tree. Any changes to tracked files // in the working tree are discarded. HardReset // MergeReset resets the index and updates the files in the working tree // that are different between Commit and HEAD, but keeps those which are // different between the index and working tree (i.e. which have changes // which have not been added). // // If a file that is different between Commit and the index has unstaged // changes, reset is aborted. MergeReset // SoftReset does not touch the index file or the working tree at all (but // resets the head to <commit>, just like all modes do). This leaves all // your changed files "Changes to be committed", as git status would put it. SoftReset )
type ResetOptions ¶
type ResetOptions struct { // Commit, if commit is present set the current branch head (HEAD) to it. Commit plumbing.Hash // Mode, form resets the current branch head to Commit and possibly updates // the index (resetting it to the tree of Commit) and the working tree // depending on Mode. If empty MixedReset is used. Mode ResetMode // Fetch missing objects Fetch bool // One by one checkout files One bool Quiet bool }
ResetOptions describes how a reset operation should be performed.
func (*ResetOptions) Validate ¶
func (o *ResetOptions) Validate(r *Repository) error
Validate validates the fields and sets the default values.
type RestoreOptions ¶
type ShowReferenceOptions ¶
type ShowReferenceOptions struct { T bool // tags default: true H bool // heads default: true Dereference bool }
TODO: support show-ref ???
type StashPushOptions ¶
type StashPushOptions struct {
U bool
}
type Status ¶
type Status map[string]*FileStatus
Status represents the current status of a Worktree. The key of the map is the path of the file.
func (Status) File ¶
func (s Status) File(path string) *FileStatus
File returns the FileStatus for a given path, if the FileStatus doesn't exists a new FileStatus is added to the map using the path as key.
func (Status) IsModified ¶
IsModified checks if file for given path is 'Modified'.
func (Status) IsUntracked ¶
IsUntracked checks if file for given path is 'Untracked'
type StatusCode ¶
type StatusCode byte
StatusCode status code of a file in the Worktree
const ( Unmodified StatusCode = ' ' Untracked StatusCode = '?' Modified StatusCode = 'M' Added StatusCode = 'A' Deleted StatusCode = 'D' Renamed StatusCode = 'R' Copied StatusCode = 'C' UpdatedButUnmerged StatusCode = 'U' )
type StringArray ¶
type StringArray []string
type SwitchOptions ¶
type SwitchOptions struct { Force bool // aka discardChanges Merge bool ForceCreate bool Remote bool Limit int64 // contains filtered or unexported fields }
func (*SwitchOptions) Validate ¶
func (so *SwitchOptions) Validate() error
type UnsetConfigOptions ¶
type UpdateConfigOptions ¶
type Worktree ¶
type Worktree struct { // External excludes not found in the repository .gitignore/.zetaignore Excludes []ignore.Pattern *Repository // contains filtered or unexported fields }
Worktree represents a zeta worktree.
func (*Worktree) AddGlob ¶
AddGlob adds all paths, matching pattern, to the index. If pattern matches a directory path, all directory contents are added to the index recursively. No error is returned if all matching paths are already staged in index.
func (*Worktree) AddTracked ¶
func (*Worktree) AddWithOptions ¶
func (w *Worktree) AddWithOptions(ctx context.Context, opts *AddOptions) error
AddWithOptions file contents to the index, updates the index using the current content found in the working tree, to prepare the content staged for the next commit.
It typically adds the current content of existing paths as a whole, but with some options it can also be used to add content with only part of the changes made to the working tree files applied, or remove paths that do not exist in the working tree anymore.
func (*Worktree) Checkout ¶
func (w *Worktree) Checkout(ctx context.Context, opts *CheckoutOptions) error
func (*Worktree) Clean ¶
func (w *Worktree) Clean(ctx context.Context, opts *CleanOptions) error
Clean the worktree by removing untracked files. An empty dir could be removed - this is what `zeta clean -f -d .` does.
func (*Worktree) Commit ¶
Commit stores the current contents of the index in a new commit along with a log message from the user describing the changes.
func (*Worktree) DiffContext ¶
func (*Worktree) DiffTreeWithIndex ¶
func (*Worktree) DiffTreeWithWorktree ¶
func (*Worktree) DoCheckIgnore ¶
func (w *Worktree) DoCheckIgnore(ctx context.Context, opts *CheckIgnoreOption) error
func (*Worktree) Grep ¶
func (w *Worktree) Grep(ctx context.Context, opts *GrepOptions) ([]GrepResult, error)
Grep performs grep on a worktree.
func (*Worktree) LsFiles ¶
func (w *Worktree) LsFiles(ctx context.Context, opts *LsFilesOptions) error
func (*Worktree) RemoveGlob ¶
RemoveGlob removes all paths, matching pattern, from the index. If pattern matches a directory path, all directory contents are removed from the index recursively.
func (*Worktree) RemoveLegecy ¶
RemoveLegecy removes files from the working tree and from the index.
func (*Worktree) ResetSparsely ¶
func (w *Worktree) ResetSparsely(ctx context.Context, opts *ResetOptions, bar ProgressBar) error
func (*Worktree) Restore ¶
func (w *Worktree) Restore(ctx context.Context, opts *RestoreOptions) error
func (*Worktree) StashApply ¶
func (*Worktree) StashPush ¶
func (w *Worktree) StashPush(ctx context.Context, opts *StashPushOptions) error
Source Files ¶
- aria2.go
- branch.go
- cat.go
- cherry_pick.go
- config.go
- dragonfly.go
- editor.go
- fetch.go
- gc.go
- log.go
- lstree.go
- merge_tree.go
- misc.go
- objects.go
- options.go
- pager.go
- promisor.go
- push.go
- references.go
- repository.go
- revision.go
- status.go
- switch.go
- tag.go
- transfer.go
- tree.go
- update.go
- worktree.go
- worktree_checkout.go
- worktree_co-extra.go
- worktree_commit.go
- worktree_diff.go
- worktree_linux.go
- worktree_ls_files.go
- worktree_merge.go
- worktree_pull.go
- worktree_rebase.go
- worktree_restore.go
- worktree_stash.go
- worktree_status.go
- worktree_tree.go