Documentation
¶
Overview ¶
Package git provides utilities for git operations across multiple repositories.
Index ¶
- func IsNonFastForward(err error) bool
- func NewService(opts ServiceOptions) func(*framework.Core) (any, error)
- func Pull(ctx context.Context, path string) error
- func Push(ctx context.Context, path string) error
- type GitError
- type PushResult
- type QueryAheadRepos
- type QueryDirtyRepos
- type QueryStatus
- type RepoStatus
- type Service
- type ServiceOptions
- type StatusOptions
- type TaskPull
- type TaskPush
- type TaskPushMultiple
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsNonFastForward ¶
IsNonFastForward checks if an error is a non-fast-forward rejection.
func NewService ¶
func NewService(opts ServiceOptions) func(*framework.Core) (any, error)
NewService creates a git service factory.
Types ¶
type GitError ¶
GitError wraps a git command error with stderr output.
type PushResult ¶
PushResult represents the result of a push operation.
func PushMultiple ¶
PushMultiple pushes multiple repositories sequentially. Sequential because SSH passphrase prompts need user interaction.
type QueryAheadRepos ¶
type QueryAheadRepos struct{}
QueryAheadRepos requests repos with unpushed commits.
type QueryDirtyRepos ¶
type QueryDirtyRepos struct{}
QueryDirtyRepos requests repos with uncommitted changes.
type QueryStatus ¶
QueryStatus requests git status for paths.
type RepoStatus ¶
type RepoStatus struct {
Name string
Path string
Modified int
Untracked int
Staged int
Ahead int
Behind int
Branch string
Error error
}
RepoStatus represents the git status of a single repository.
func Status ¶
func Status(ctx context.Context, opts StatusOptions) []RepoStatus
Status checks git status for multiple repositories in parallel.
func (*RepoStatus) HasUnpulled ¶
func (s *RepoStatus) HasUnpulled() bool
HasUnpulled returns true if there are commits to pull.
func (*RepoStatus) HasUnpushed ¶
func (s *RepoStatus) HasUnpushed() bool
HasUnpushed returns true if there are commits to push.
func (*RepoStatus) IsDirty ¶
func (s *RepoStatus) IsDirty() bool
IsDirty returns true if there are uncommitted changes.
type Service ¶
type Service struct {
*framework.ServiceRuntime[ServiceOptions]
// contains filtered or unexported fields
}
Service provides git operations as a Core service.
func (*Service) AheadRepos ¶
func (s *Service) AheadRepos() []RepoStatus
AheadRepos returns repos with unpushed commits.
func (*Service) DirtyRepos ¶
func (s *Service) DirtyRepos() []RepoStatus
DirtyRepos returns repos with uncommitted changes.
type ServiceOptions ¶
type ServiceOptions struct {
WorkDir string
}
ServiceOptions for configuring the git service.
type StatusOptions ¶
type StatusOptions struct {
// Paths is a list of repo paths to check
Paths []string
// Names maps paths to display names
Names map[string]string
}
StatusOptions configures the status check.
type TaskPushMultiple ¶
TaskPushMultiple requests git push for multiple paths.