Documentation
¶
Overview ¶
Package git is the production git adapter for the sdd binary: every git subprocess sdd runs is implemented here, behind the narrow interfaces its consumers define (handlers.Committer/Brancher/Mover/Puller, finders.GitSyncer, the repos package's clone/pull surface). Interfaces stay with their consumers; this package only provides the implementations, so a future — possibly partial — swap to an in-process implementation such as go-git touches nothing but this package.
Index ¶
- func RemoteURL(repoRoot string) string
- func RepoRoot() (string, error)
- func UserName() string
- type CLI
- func (CLI) BranchMerged(branch string) bool
- func (CLI) Checkout(branch string, create bool) error
- func (CLI) Clone(ctx context.Context, url, dir string) error
- func (CLI) Commit(message string, paths ...string) error
- func (CLI) CountCommits(ctx context.Context, rangeSpec, grepPattern string) (int, error)
- func (CLI) DeleteBranch(branch string, force bool) error
- func (CLI) Fetch(ctx context.Context) error
- func (CLI) HasCommitMessage(ctx context.Context, text string) (bool, error)
- func (CLI) HasRemote(ctx context.Context) bool
- func (CLI) InRepo(ctx context.Context) bool
- func (CLI) IsClean(ctx context.Context) (bool, error)
- func (CLI) MergePull(ctx context.Context) (string, error)
- func (CLI) MergeTreePredict(ctx context.Context, ourRef, theirRef string) ([]string, error)
- func (CLI) Move(src, dst string) error
- func (CLI) PullFFOnly(ctx context.Context, dir string) error
- func (CLI) UpstreamRef(ctx context.Context) (string, error)
- type RemovalCommitter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RemoteURL ¶
RemoteURL returns the repo's origin remote URL, or "" when no remote is configured — the local-only case for repo_id derivation.
Types ¶
type CLI ¶
type CLI struct{}
CLI is the exec-based adapter: a zero-value struct whose methods shell out to the git binary. One value satisfies the consumer-defined git interfaces (handlers.Committer/Brancher/Mover/Puller, finders.GitSyncer, repos.Git); the one exception is the staged-deletion commit variant, which shares the Commit method name and therefore lives on its own type (RemovalCommitter).
func (CLI) BranchMerged ¶
BranchMerged reports whether branch is merged into the current HEAD.
func (CLI) Checkout ¶
Checkout switches to branch, creating it first when create is set. Production handlers.Brancher.
func (CLI) Commit ¶
Commit stages exactly the given paths and commits them, detached from any controlling terminal. It is the production handlers.Committer for the auto-commit paths (sdd new, summarize, init, ...).
func (CLI) CountCommits ¶
CountCommits counts commits in rangeSpec whose messages match grepPattern.
func (CLI) DeleteBranch ¶
DeleteBranch removes branch (-d, or -D when force is set).
func (CLI) HasCommitMessage ¶ added in v0.16.0
HasCommitMessage reports whether any reachable commit contains text. It is used by retryable post-apply finalizers to recognize a commit that landed before its durable finalizer outcome could be recorded.
func (CLI) IsClean ¶
IsClean reports whether the working tree has no uncommitted changes. Production handlers.Puller.
func (CLI) MergePull ¶
MergePull runs a merge-only pull. --no-rebase forces a merge pull regardless of the user's pull.rebase config, so background sync never rewrites the shared graph's history.
func (CLI) MergeTreePredict ¶
MergeTreePredict simulates a three-way merge in memory and returns the paths that would conflict.
func (CLI) Move ¶
Move renames a path in the working tree and the git index as one operation via `git mv`, so the rename is recorded atomically with the working-tree change. Production handlers.Mover.
func (CLI) PullFFOnly ¶
PullFFOnly pulls the checkout at dir, fast-forward only — the caches are read-only, so a non-ff state means the remote rewrote history; that surfaces as the error rather than merging.
type RemovalCommitter ¶
type RemovalCommitter struct{}
RemovalCommitter is the handlers.Committer variant for paths already removed from disk: it stages the deletions (`git rm --cached`, falling back to `git add`) before committing. Used by FinishWIP, where the marker file is gone by the time the commit runs.