Versions in this module Expand all Collapse all v1 v1.10.1 Jul 5, 2023 v1.4.0 Jul 5, 2023 Changes in this version + const GitDirName + var ErrAnonymousRemoteName = errors.New("anonymous remote name must be 'anonymous'") + var ErrBranchExists = errors.New("branch already exists") + var ErrBranchHashExclusive = errors.New("Branch and Hash are mutually exclusive") + var ErrBranchNotFound = errors.New("branch not found") + var ErrCreateRequiresBranch = errors.New("Branch is mandatory when Create is used") + var ErrDeleteRefNotSupported = errors.New("server does not support delete-refs") + var ErrDestinationExists = errors.New("destination exists") + var ErrEmptyCommit = errors.New("cannot create empty commit: clean working tree") + var ErrEmptyUrls = errors.New("URLs cannot be empty") + var ErrExactSHA1NotSupported = errors.New("server does not support exact SHA1 refspec") + var ErrFetching = errors.New("unable to fetch packfile") + var ErrForceNeeded = errors.New("some refs were not updated") + var ErrGitModulesSymlink = errors.New(gitmodulesFile + " is a symlink") + var ErrGlobNoMatches = errors.New("glob pattern did not match any files") + var ErrHashOrReference = errors.New("ambiguous options, only one of CommitHash or ReferenceName can be passed") + var ErrInvalidReference = errors.New("invalid reference, should be a tag or a branch") + var ErrIsBareRepository = errors.New("worktree not available in a bare repository") + var ErrLooseObjectsNotSupported = errors.New("loose objects not supported") + var ErrMissingAuthor = errors.New("author field is required") + var ErrMissingMessage = errors.New("message field is required") + var ErrMissingName = errors.New("name field is required") + var ErrMissingTagger = errors.New("tagger field is required") + var ErrMissingURL = errors.New("URL field is required") + var ErrNonFastForwardUpdate = errors.New("non-fast-forward update") + var ErrPackedObjectsNotSupported = errors.New("packed objects not supported") + var ErrRemoteExists = errors.New("remote already exists") + var ErrRemoteNotFound = errors.New("remote not found") + var ErrRepositoryAlreadyExists = errors.New("repository already exists") + var ErrRepositoryIncomplete = errors.New("repository's commondir path does not exist") + var ErrRepositoryNotExists = errors.New("repository does not exist") + var ErrSHA256NotSupported = errors.New("go-git was not compiled with SHA256 support") + var ErrSubmoduleAlreadyInitialized = errors.New("submodule already initialized") + var ErrSubmoduleNotFound = errors.New("submodule not found") + var ErrSubmoduleNotInitialized = errors.New("submodule not initialized") + var ErrTagExists = errors.New("tag already exists") + var ErrTagNotFound = errors.New("tag not found") + var ErrUnableToResolveCommit = errors.New("unable to resolve commit") + var ErrUnstagedChanges = errors.New("worktree contains unstaged changes") + var ErrWorktreeNotClean = errors.New("worktree is not clean") + var ErrWorktreeNotProvided = errors.New("worktree should be provided") + var NoErrAlreadyUpToDate = errors.New("already up-to-date") + type AddOptions struct + All bool + Glob string + Path string + func (o *AddOptions) Validate(r *Repository) error + type BlameResult struct + Lines []*Line + Path string + Rev plumbing.Hash + func Blame(c *object.Commit, path string) (*BlameResult, error) + type CheckoutOptions struct + Branch plumbing.ReferenceName + Create bool + Force bool + Hash plumbing.Hash + Keep bool + SparseCheckoutDirectories []string + func (o *CheckoutOptions) Validate() error + type CleanOptions struct + Dir bool + type CloneOptions struct + Auth transport.AuthMethod + CABundle []byte + Depth int + InsecureSkipTLS bool + Mirror bool + NoCheckout bool + Progress sideband.Progress + ProxyOptions transport.ProxyOptions + RecurseSubmodules SubmoduleRescursivity + ReferenceName plumbing.ReferenceName + RemoteName string + ShallowSubmodules bool + SingleBranch bool + Tags TagMode + URL string + func (o *CloneOptions) Validate() error + type CommitOptions struct + All bool + AllowEmptyCommits bool + Author *object.Signature + Committer *object.Signature + Parents []plumbing.Hash + SignKey *openpgp.Entity + func (o *CommitOptions) Validate(r *Repository) error + type CreateTagOptions struct + Message string + SignKey *openpgp.Entity + Tagger *object.Signature + func (o *CreateTagOptions) Validate(r *Repository, hash plumbing.Hash) error + type FetchOptions struct + Auth transport.AuthMethod + CABundle []byte + Depth int + Force bool + InsecureSkipTLS bool + Progress sideband.Progress + ProxyOptions transport.ProxyOptions + RefSpecs []config.RefSpec + RemoteName string + RemoteURL string + Tags TagMode + func (o *FetchOptions) Validate() error + type FileStatus struct + Extra string + Staging StatusCode + Worktree StatusCode + type ForceWithLease struct + Hash plumbing.Hash + RefName plumbing.ReferenceName + type GrepOptions struct + CommitHash plumbing.Hash + InvertMatch bool + PathSpecs []*regexp.Regexp + Patterns []*regexp.Regexp + ReferenceName plumbing.ReferenceName + func (o *GrepOptions) Validate(w *Worktree) error + type GrepResult struct + Content string + FileName string + LineNumber int + TreeName string + func (gr GrepResult) String() string + type InitOptions struct + DefaultBranch plumbing.ReferenceName + type Line struct + Author string + Date time.Time + Hash plumbing.Hash + Text string + type ListOptions struct + Auth transport.AuthMethod + CABundle []byte + InsecureSkipTLS bool + PeelingOption PeelingOption + ProxyOptions transport.ProxyOptions + Timeout int + type LogOptions struct + All bool + FileName *string + From plumbing.Hash + Order LogOrder + PathFilter func(string) bool + Since *time.Time + Until *time.Time + type LogOrder int8 + const LogOrderBSF + const LogOrderCommitterTime + const LogOrderDFS + const LogOrderDFSPost + const LogOrderDefault + type NoMatchingRefSpecError struct + func (e NoMatchingRefSpecError) Error() string + func (e NoMatchingRefSpecError) Is(target error) bool + type PeelingOption uint8 + const AppendPeeled + const IgnorePeeled + const OnlyPeeled + type PlainInitOptions struct + ObjectFormat formatcfg.ObjectFormat + func (o *PlainInitOptions) Validate() error + type PlainOpenOptions struct + DetectDotGit bool + EnableDotGitCommonDir bool + func (o *PlainOpenOptions) Validate() error + type PruneHandler func(unreferencedObjectHash plumbing.Hash) error + type PruneOptions struct + Handler PruneHandler + OnlyObjectsOlderThan time.Time + type PullOptions struct + Auth transport.AuthMethod + CABundle []byte + Depth int + Force bool + InsecureSkipTLS bool + Progress sideband.Progress + ProxyOptions transport.ProxyOptions + RecurseSubmodules SubmoduleRescursivity + ReferenceName plumbing.ReferenceName + RemoteName string + RemoteURL string + SingleBranch bool + func (o *PullOptions) Validate() error + type PushOptions struct + Atomic bool + Auth transport.AuthMethod + CABundle []byte + FollowTags bool + Force bool + ForceWithLease *ForceWithLease + InsecureSkipTLS bool + Options map[string]string + Progress sideband.Progress + ProxyOptions transport.ProxyOptions + Prune bool + RefSpecs []config.RefSpec + RemoteName string + RemoteURL string + RequireRemoteRefs []config.RefSpec + func (o *PushOptions) Validate() error + type Remote struct + func NewRemote(s storage.Storer, c *config.RemoteConfig) *Remote + func (r *Remote) Config() *config.RemoteConfig + func (r *Remote) Fetch(o *FetchOptions) error + func (r *Remote) FetchContext(ctx context.Context, o *FetchOptions) error + func (r *Remote) List(o *ListOptions) (rfs []*plumbing.Reference, err error) + func (r *Remote) ListContext(ctx context.Context, o *ListOptions) (rfs []*plumbing.Reference, err error) + func (r *Remote) Push(o *PushOptions) error + func (r *Remote) PushContext(ctx context.Context, o *PushOptions) (err error) + func (r *Remote) String() string + type RepackConfig struct + OnlyDeletePacksOlderThan time.Time + UseRefDeltas bool + type Repository struct + Storer storage.Storer + func Clone(s storage.Storer, worktree billy.Filesystem, o *CloneOptions) (*Repository, error) + func CloneContext(ctx context.Context, s storage.Storer, worktree billy.Filesystem, ...) (*Repository, error) + func Init(s storage.Storer, worktree billy.Filesystem) (*Repository, error) + func InitWithOptions(s storage.Storer, worktree billy.Filesystem, options InitOptions) (*Repository, error) + func Open(s storage.Storer, worktree billy.Filesystem) (*Repository, error) + func PlainClone(path string, isBare bool, o *CloneOptions) (*Repository, error) + func PlainCloneContext(ctx context.Context, path string, isBare bool, o *CloneOptions) (*Repository, error) + func PlainInit(path string, isBare bool) (*Repository, error) + func PlainInitWithOptions(path string, opts *PlainInitOptions) (*Repository, error) + func PlainOpen(path string) (*Repository, error) + func PlainOpenWithOptions(path string, o *PlainOpenOptions) (*Repository, error) + func (r *Repository) BlobObject(h plumbing.Hash) (*object.Blob, error) + func (r *Repository) BlobObjects() (*object.BlobIter, error) + func (r *Repository) Branch(name string) (*config.Branch, error) + func (r *Repository) Branches() (storer.ReferenceIter, error) + func (r *Repository) CommitObject(h plumbing.Hash) (*object.Commit, error) + func (r *Repository) CommitObjects() (object.CommitIter, error) + func (r *Repository) Config() (*config.Config, error) + func (r *Repository) ConfigScoped(scope config.Scope) (*config.Config, error) + func (r *Repository) CreateBranch(c *config.Branch) error + func (r *Repository) CreateRemote(c *config.RemoteConfig) (*Remote, error) + func (r *Repository) CreateRemoteAnonymous(c *config.RemoteConfig) (*Remote, error) + func (r *Repository) CreateTag(name string, hash plumbing.Hash, opts *CreateTagOptions) (*plumbing.Reference, error) + func (r *Repository) DeleteBranch(name string) error + func (r *Repository) DeleteObject(hash plumbing.Hash) error + func (r *Repository) DeleteRemote(name string) error + func (r *Repository) DeleteTag(name string) error + func (r *Repository) Fetch(o *FetchOptions) error + func (r *Repository) FetchContext(ctx context.Context, o *FetchOptions) error + func (r *Repository) Grep(opts *GrepOptions) ([]GrepResult, error) + func (r *Repository) Head() (*plumbing.Reference, error) + func (r *Repository) Log(o *LogOptions) (object.CommitIter, error) + func (r *Repository) Notes() (storer.ReferenceIter, error) + func (r *Repository) Object(t plumbing.ObjectType, h plumbing.Hash) (object.Object, error) + func (r *Repository) Objects() (*object.ObjectIter, error) + func (r *Repository) Prune(opt PruneOptions) error + func (r *Repository) Push(o *PushOptions) error + func (r *Repository) PushContext(ctx context.Context, o *PushOptions) error + func (r *Repository) Reference(name plumbing.ReferenceName, resolved bool) (*plumbing.Reference, error) + func (r *Repository) References() (storer.ReferenceIter, error) + func (r *Repository) Remote(name string) (*Remote, error) + func (r *Repository) Remotes() ([]*Remote, error) + func (r *Repository) RepackObjects(cfg *RepackConfig) (err error) + func (r *Repository) ResolveRevision(in plumbing.Revision) (*plumbing.Hash, error) + func (r *Repository) SetConfig(cfg *config.Config) error + func (r *Repository) Tag(name string) (*plumbing.Reference, error) + func (r *Repository) TagObject(h plumbing.Hash) (*object.Tag, error) + func (r *Repository) TagObjects() (*object.TagIter, error) + func (r *Repository) Tags() (storer.ReferenceIter, error) + func (r *Repository) TreeObject(h plumbing.Hash) (*object.Tree, error) + func (r *Repository) TreeObjects() (*object.TreeIter, error) + func (r *Repository) Worktree() (*Worktree, error) + type ResetMode int8 + const HardReset + const MergeReset + const MixedReset + const SoftReset + type ResetOptions struct + Commit plumbing.Hash + Mode ResetMode + func (o *ResetOptions) Validate(r *Repository) error + type Status map[string]*FileStatus + func (s Status) File(path string) *FileStatus + func (s Status) IsClean() bool + func (s Status) IsUntracked(path string) bool + func (s Status) String() string + type StatusCode byte + const Added + const Copied + const Deleted + const Modified + const Renamed + const Unmodified + const Untracked + const UpdatedButUnmerged + type Submodule struct + func (s *Submodule) Config() *config.Submodule + func (s *Submodule) Init() error + func (s *Submodule) Repository() (*Repository, error) + func (s *Submodule) Status() (*SubmoduleStatus, error) + func (s *Submodule) Update(o *SubmoduleUpdateOptions) error + func (s *Submodule) UpdateContext(ctx context.Context, o *SubmoduleUpdateOptions) error + type SubmoduleRescursivity uint + const DefaultRemoteName + const DefaultSubmoduleRecursionDepth + const NoRecurseSubmodules + type SubmoduleStatus struct + Branch plumbing.ReferenceName + Current plumbing.Hash + Expected plumbing.Hash + Path string + func (s *SubmoduleStatus) IsClean() bool + func (s *SubmoduleStatus) String() string + type SubmoduleUpdateOptions struct + Auth transport.AuthMethod + Depth int + Init bool + NoFetch bool + RecurseSubmodules SubmoduleRescursivity + type Submodules []*Submodule + func (s Submodules) Init() error + func (s Submodules) Status() (SubmodulesStatus, error) + func (s Submodules) Update(o *SubmoduleUpdateOptions) error + func (s Submodules) UpdateContext(ctx context.Context, o *SubmoduleUpdateOptions) error + type SubmodulesStatus []*SubmoduleStatus + func (s SubmodulesStatus) String() string + type TagMode int + const AllTags + const InvalidTagMode + const NoTags + const TagFollowing + type Worktree struct + Excludes []gitignore.Pattern + Filesystem billy.Filesystem + func (w *Worktree) Add(path string) (plumbing.Hash, error) + func (w *Worktree) AddGlob(pattern string) error + func (w *Worktree) AddWithOptions(opts *AddOptions) error + func (w *Worktree) Checkout(opts *CheckoutOptions) error + func (w *Worktree) Clean(opts *CleanOptions) error + func (w *Worktree) Commit(msg string, opts *CommitOptions) (plumbing.Hash, error) + func (w *Worktree) Grep(opts *GrepOptions) ([]GrepResult, error) + func (w *Worktree) Move(from, to string) (plumbing.Hash, error) + func (w *Worktree) Pull(o *PullOptions) error + func (w *Worktree) PullContext(ctx context.Context, o *PullOptions) error + func (w *Worktree) Remove(path string) (plumbing.Hash, error) + func (w *Worktree) RemoveGlob(pattern string) error + func (w *Worktree) Reset(opts *ResetOptions) error + func (w *Worktree) ResetSparsely(opts *ResetOptions, dirs []string) error + func (w *Worktree) Status() (Status, error) + func (w *Worktree) Submodule(name string) (*Submodule, error) + func (w *Worktree) Submodules() (Submodules, error)