Documentation
¶
Overview ¶
Package sync implements repository synchronization logic for keeping local git repositories up to date with their remotes.
Index ¶
- type GitOps
- type Options
- type RealGitOps
- func (RealGitOps) CurrentBranch(repoPath string) (string, error)
- func (RealGitOps) DefaultBranch(repoPath string) (string, error)
- func (RealGitOps) Fetch(repoPath, remote string) error
- func (RealGitOps) HasRemote(repoPath, remote string) bool
- func (RealGitOps) IsClean(repoPath string) (bool, error)
- func (RealGitOps) MergeAbort(repoPath string) error
- func (RealGitOps) MergeBase(repoPath string, ref1, ref2 string) (string, error)
- func (RealGitOps) MergeTree(repoPath string, base, local, remote string) (string, bool, error)
- func (RealGitOps) Pull(repoPath string, strategy string) error
- func (RealGitOps) RebaseAbort(repoPath string) error
- func (RealGitOps) StashPop(repoPath string) error
- func (RealGitOps) StashPush(repoPath string, message string) error
- type Result
- type Status
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type GitOps ¶
type GitOps interface {
Fetch(repoPath, remote string) error
IsClean(repoPath string) (bool, error)
CurrentBranch(repoPath string) (string, error)
DefaultBranch(repoPath string) (string, error)
HasRemote(repoPath, remote string) bool
Pull(repoPath string, strategy string) error
MergeBase(repoPath string, ref1, ref2 string) (string, error)
MergeTree(repoPath string, base, local, remote string) (string, bool, error)
StashPush(repoPath string, message string) error
StashPop(repoPath string) error
RebaseAbort(repoPath string) error
MergeAbort(repoPath string) error
}
GitOps defines the git operations needed by the sync logic. This interface enables testing with mocks.
type Options ¶
type Options struct {
Strategy string // "rebase", "merge", "ff-only"
SkipDirty bool
AutoStash bool
DryRun bool
Verbose bool
}
Options controls sync behavior.
type RealGitOps ¶
type RealGitOps struct{}
RealGitOps implements GitOps using the pkg/git package.
func (RealGitOps) CurrentBranch ¶
func (RealGitOps) CurrentBranch(repoPath string) (string, error)
CurrentBranch returns the name of the currently checked-out branch.
func (RealGitOps) DefaultBranch ¶
func (RealGitOps) DefaultBranch(repoPath string) (string, error)
DefaultBranch returns the default branch name.
func (RealGitOps) Fetch ¶
func (RealGitOps) Fetch(repoPath, remote string) error
Fetch fetches from the given remote.
func (RealGitOps) HasRemote ¶
func (RealGitOps) HasRemote(repoPath, remote string) bool
HasRemote returns true if the given remote exists.
func (RealGitOps) IsClean ¶
func (RealGitOps) IsClean(repoPath string) (bool, error)
IsClean returns true if the working tree has no uncommitted changes.
func (RealGitOps) MergeAbort ¶
func (RealGitOps) MergeAbort(repoPath string) error
MergeAbort aborts an in-progress merge.
func (RealGitOps) MergeBase ¶
func (RealGitOps) MergeBase(repoPath string, ref1, ref2 string) (string, error)
MergeBase returns the best common ancestor commit between two refs.
func (RealGitOps) Pull ¶
func (RealGitOps) Pull(repoPath string, strategy string) error
Pull pulls from the default remote using the given strategy.
func (RealGitOps) RebaseAbort ¶
func (RealGitOps) RebaseAbort(repoPath string) error
RebaseAbort aborts an in-progress rebase.
func (RealGitOps) StashPop ¶
func (RealGitOps) StashPop(repoPath string) error
StashPop applies and removes the most recent stash entry.