Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrConflictResolutionFailed = stderrors.New("conflict resolution failed")
ErrConflictResolutionFailed is returned by Pull when the ConflictResolver returns an error. The merge is aborted before returning so the repo is left in a clean state. Callers detect this via errors.Is(err, ErrConflictResolutionFailed).
var ErrInvalidPath = stderrors.New("invalid path")
ErrInvalidPath is returned when the requested path fails validation.
var ErrNotFound = stderrors.New("file not found")
ErrNotFound is returned when a requested file does not exist in the repository.
var ErrRepoUnrecoverable = stderrors.New("repo state unrecoverable")
ErrRepoUnrecoverable is returned by Pull when the repository is in a state that cannot be automatically healed (e.g., git rebase --abort fails, or refs/remotes/origin/HEAD is missing for detached-HEAD recovery). Callers detect this via errors.Is(err, ErrRepoUnrecoverable).
Functions ¶
This section is empty.
Types ¶
type ConflictResolver ¶ added in v0.20.0
ConflictResolver is called by the puller when git merge produces unresolvable conflicts. Resolve receives the list of conflicted file paths as reported by git merge output. It must stage each path (git add) before returning nil so the puller can commit the merge. On error the puller runs git merge --abort and returns ErrConflictResolutionFailed.
func NewMarkerResolver ¶ added in v0.20.0
func NewMarkerResolver(repoPath string) ConflictResolver
NewMarkerResolver returns a ConflictResolver that preserves git's standard conflict markers. It stages each conflicted file as-is: the <<<<<<< / ======= / >>>>>>> markers written by git's three-way merge are left intact in the committed file. The next human or agent edit resolves them naturally.
type Git ¶
type Git interface {
WriteFile(ctx context.Context, path string, content []byte) error
DeleteFile(ctx context.Context, path string) error
ReadFile(ctx context.Context, path string) ([]byte, error)
ListFiles(ctx context.Context, pattern string) ([]string, error)
Pull(ctx context.Context) error
Status(ctx context.Context) (Status, error)
Clone(ctx context.Context, remoteURL RemoteURL) error
ConfigureUser(ctx context.Context, name string, email string) error
Init(ctx context.Context) error
}
Git abstracts all git shell operations on a local repository.
func New ¶
func New( repoPath string, m metrics.Metrics, currentDateTimeGetter libtime.CurrentDateTimeGetter, sshKeyPath SSHKeyPath, ) Git
New returns a Git implementation backed by the system git binary for the given repository path.
type RebaseConflictError ¶ added in v0.19.2
type RebaseConflictError struct {
Path string // conflicted file path, from "CONFLICT (content): Merge conflict in <path>"
}
RebaseConflictError is returned by Pull when git rebase encounters a content conflict. The repo is left in its conflicted state for human inspection. git rebase --abort is NEVER invoked automatically.
func (*RebaseConflictError) Error ¶ added in v0.19.2
func (e *RebaseConflictError) Error() string
type RemoteURL ¶ added in v0.9.0
type RemoteURL string
RemoteURL is the URL of a remote git repository.
type SSHKeyPath ¶ added in v0.8.0
type SSHKeyPath string
SSHKeyPath is the path to an SSH private key used for git operations.