Documentation
¶
Overview ¶
Package git owns git CLI interaction for initech project bootstrap. It handles repo initialization, submodule management, and commits.
All operations take an exec.Runner, making the package fully testable without a real git installation. This package does not know about config or scaffold.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddSubmodule ¶
AddSubmodule adds a git submodule at the specified path within the repo. The path is relative to the repo root (e.g., "eng1/src"). The URL is normalized before use (bare hostnames get git@ SSH prefix).
func CleanFailedSubmodule ¶ added in v1.10.3
CleanFailedSubmodule removes leftover artifacts from a failed git submodule add. This prevents cascading failures: a stale index.lock blocks all subsequent git operations, and partial checkout directories cause "does not have a commit checked out" errors during git add.
Cleanup is best-effort; errors are silently ignored because the artifacts may not all exist depending on where the submodule add failed.
func CommitAll ¶
CommitAll stages all files and creates a commit with the given message. Returns an error if staging or commit fails.
func Init ¶
Init runs git init in the given directory. If the directory already contains a .git directory, it's a no-op and returns nil.
func IsEmptyRepoError ¶ added in v1.10.3
IsEmptyRepoError reports whether the error indicates the remote repository has no commits. This happens when git submodule add clones a freshly created repo (e.g., a new GitHub repo with no initial commit). Git fails with "You are on a branch yet to be born" because there is no HEAD to check out.
Types ¶
This section is empty.