Documentation
¶
Overview ¶
Package git wraps git commands and helpers used by lazyworktree.
Index ¶
- type NotifyFn
- type NotifyOnceFn
- type Service
- func (s *Service) ApplyDelta(ctx context.Context, diff string) string
- func (s *Service) BuildThreePartDiff(ctx context.Context, path string, cfg *config.AppConfig) string
- func (s *Service) ExecuteCommands(ctx context.Context, cmdList []string, cwd string, env map[string]string) error
- func (s *Service) FetchCIStatus(ctx context.Context, prNumber int, branch string) ([]*models.CICheck, error)
- func (s *Service) FetchPRMap(ctx context.Context) (map[string]*models.PRInfo, error)
- func (s *Service) GetMainBranch(ctx context.Context) string
- func (s *Service) GetMainWorktreePath(ctx context.Context) string
- func (s *Service) GetWorktrees(ctx context.Context) ([]*models.WorktreeInfo, error)
- func (s *Service) RenameWorktree(ctx context.Context, oldPath, newPath, oldBranch, newBranch string) bool
- func (s *Service) ResolveRepoName(ctx context.Context) string
- func (s *Service) RunCommandChecked(ctx context.Context, args []string, cwd string, errorPrefix string) bool
- func (s *Service) RunGit(ctx context.Context, args []string, cwd string, okReturncodes []int, ...) string
- func (s *Service) UseDelta() bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type NotifyOnceFn ¶
NotifyOnceFn reports deduplicated notification messages.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service orchestrates git and helper commands for the UI.
func NewService ¶
func NewService(notify NotifyFn, notifyOnce NotifyOnceFn) *Service
NewService constructs a Service and sets up concurrency limits.
func (*Service) ApplyDelta ¶
ApplyDelta pipes diff output through delta if available ApplyDelta pipes diff output through delta when available.
func (*Service) BuildThreePartDiff ¶
func (s *Service) BuildThreePartDiff(ctx context.Context, path string, cfg *config.AppConfig) string
BuildThreePartDiff builds a comprehensive diff with staged, unstaged, and untracked changes BuildThreePartDiff assembles a diff showing staged, modified, and untracked sections.
func (*Service) ExecuteCommands ¶
func (s *Service) ExecuteCommands(ctx context.Context, cmdList []string, cwd string, env map[string]string) error
ExecuteCommands runs provided shell commands sequentially inside the given working directory.
func (*Service) FetchCIStatus ¶
func (s *Service) FetchCIStatus(ctx context.Context, prNumber int, branch string) ([]*models.CICheck, error)
FetchCIStatus fetches CI check statuses for a PR from GitHub or GitLab.
func (*Service) FetchPRMap ¶
FetchPRMap fetches PR/MR information from GitHub or GitLab FetchPRMap gathers PR information via supported host APIs.
func (*Service) GetMainBranch ¶
GetMainBranch returns the main branch name for the current repository.
func (*Service) GetMainWorktreePath ¶
GetMainWorktreePath returns the path of the main worktree.
func (*Service) GetWorktrees ¶
GetWorktrees parses git worktree metadata and returns the list of worktrees.
func (*Service) RenameWorktree ¶
func (s *Service) RenameWorktree(ctx context.Context, oldPath, newPath, oldBranch, newBranch string) bool
RenameWorktree attempts to move and rename branches for a worktree migration.
func (*Service) ResolveRepoName ¶
ResolveRepoName resolves the repository name using various methods ResolveRepoName returns the repository identifier for caching purposes.
func (*Service) RunCommandChecked ¶
func (s *Service) RunCommandChecked(ctx context.Context, args []string, cwd string, errorPrefix string) bool
RunCommandChecked runs the provided git command and reports failures via notify callbacks.