Documentation ¶
Overview ¶
Package execute provides reusable high-level functionality shared by all Git Town commands but doesn't have a place in other subsystems because it needs to use many subsystems together.
Index ¶
- func EnsureKnownBranchesAncestry(args EnsureKnownBranchesAncestryArgs) error
- func LoadRepoSnapshot(args LoadRepoSnapshotArgs) (gitdomain.BranchesSnapshot, gitdomain.StashSize, bool, error)
- type EnsureKnownBranchesAncestryArgs
- type FailureCollector
- func (self *FailureCollector) BranchInfos(value gitdomain.BranchInfos, err error) gitdomain.BranchInfos
- func (self *FailureCollector) Check(err error) bool
- func (self *FailureCollector) Fail(format string, a ...any)
- func (self *FailureCollector) Remotes(value gitdomain.Remotes, err error) gitdomain.Remotes
- type LoadRepoSnapshotArgs
- type OpenRepoArgs
- type OpenRepoResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EnsureKnownBranchesAncestry ¶
func EnsureKnownBranchesAncestry(args EnsureKnownBranchesAncestryArgs) error
EnsureKnownBranchesAncestry makes sure the entire repo lineage is known. If needed, it queries the user for missing information. It returns the updated version of all information that is derived from the lineage.
The purpose of this function is to implement proper cache invalidation. It ensures that all information derived from lineage gets updated when the lineage is updated.
func LoadRepoSnapshot ¶
func LoadRepoSnapshot(args LoadRepoSnapshotArgs) (gitdomain.BranchesSnapshot, gitdomain.StashSize, bool, error)
LoadRepoSnapshot loads the initial snapshot of the Git repo.
Types ¶
type EnsureKnownBranchesAncestryArgs ¶
type EnsureKnownBranchesAncestryArgs struct { BranchesToVerify gitdomain.LocalBranchNames Config *config.Config DefaultChoice gitdomain.LocalBranchName DialogTestInputs *components.TestInputs LocalBranches gitdomain.BranchInfos MainBranch gitdomain.LocalBranchName Runner *git.ProdRunner }
type FailureCollector ¶
type FailureCollector struct {
Err error `exhaustruct:"optional"`
}
FailureCollector helps avoid excessive error checking while gathering a larger number of values through fallible operations. This is based on ideas outlined in https://go.dev/blog/errors-are-values.
Please be aware that using this technique can lead to executing logic that would normally not run, using potentially invalid data, and potentially leading to unexpected runtime exceptions and side effects. Use with care and only if it's abundantly clear and obvious that there are no negative side effects. This is an anti-pattern in code to work arount an anti-pattern in the language.
func (*FailureCollector) BranchInfos ¶
func (self *FailureCollector) BranchInfos(value gitdomain.BranchInfos, err error) gitdomain.BranchInfos
func (*FailureCollector) Check ¶
func (self *FailureCollector) Check(err error) bool
Check registers the given error and indicates whether this ErrorChecker contains an error now.
func (*FailureCollector) Fail ¶
func (self *FailureCollector) Fail(format string, a ...any)
Fail registers the error constructed using the given format arguments.
type LoadRepoSnapshotArgs ¶
type LoadRepoSnapshotArgs struct { Config *config.Config DialogTestInputs components.TestInputs Fetch bool HandleUnfinishedState bool Repo *OpenRepoResult RepoStatus gitdomain.RepoStatus ValidateIsConfigured bool ValidateNoOpenChanges bool Verbose bool }
type OpenRepoArgs ¶
type OpenRepoResult ¶
type OpenRepoResult struct { ConfigSnapshot undoconfig.ConfigSnapshot IsOffline configdomain.Offline RootDir gitdomain.RepoRootDir Runner *git.ProdRunner }
func OpenRepo ¶
func OpenRepo(args OpenRepoArgs) (*OpenRepoResult, error)