Documentation
¶
Overview ¶
Package git wraps go-git to push, pull, and inspect the vault repository.
Index ¶
- Variables
- func AbortMerge(repoRoot string) error
- func CleanVault(repoRoot string) error
- func CommitVault(repoRoot string) (string, error)
- func ConflictStage(repoRoot string, stage int, path string) ([]byte, error)
- func ConflictedFiles(repoRoot string) ([]string, error)
- func ContinueMerge(repoRoot string) error
- func CurrentBranch(repoRoot string) (string, error)
- func DetectOrigin(repoRoot string) (string, error)
- func FetchOrigin(repoRoot string) error
- func HeadHash(repoRoot string) (string, error)
- func IsVaultTracked(repoRoot string) bool
- func MergeOrigin(repoRoot string) error
- func PushOrigin(repoRoot string) error
- func StageFile(repoRoot, path string) error
Constants ¶
This section is empty.
Variables ¶
var ErrMergeConflict = errors.New("merge conflict")
ErrMergeConflict is returned by MergeOrigin when the merge produces unresolved conflicts. Inspect the working tree, call resolveSecretsConflict, then ContinueMerge — or AbortMerge to restore the pre-merge state.
var ErrNothingToCommit = errors.New("nothing to commit")
ErrNothingToCommit is returned by CommitVault when .envault/ has no staged changes — the vault is already in sync with the last commit.
Functions ¶
func AbortMerge ¶
AbortMerge aborts an in-progress merge and restores the pre-merge state.
func CleanVault ¶
CleanVault removes untracked files under .envault/ so a fast-forward merge is not blocked by "untracked working tree files would be overwritten". Files already committed to git are left untouched.
func CommitVault ¶
CommitVault stages all .envault/ files and creates a commit with the canonical message "envault: sync encrypted secrets". It returns the short (7-char) commit hash. If there are no changes it returns ErrNothingToCommit so the caller can still push unpushed commits.
func ConflictStage ¶
ConflictStage returns the raw bytes of path at the given merge stage. stage 1 = common ancestor (base), 2 = ours, 3 = theirs. Returns nil bytes (and nil error) when the file did not exist at that stage.
func ConflictedFiles ¶
ConflictedFiles returns the repo-root-relative paths of all files that have unresolved merge conflicts (i.e., appear as "UU" in the index).
func ContinueMerge ¶
ContinueMerge commits the in-progress merge using the auto-generated message.
func CurrentBranch ¶
CurrentBranch returns the name of the currently checked-out branch.
func DetectOrigin ¶
DetectOrigin reads the URL of the "origin" remote by parsing .git/config inside repoRoot directly — no git binary required. Returns an empty string when the file is absent or no origin is configured.
func FetchOrigin ¶
FetchOrigin fetches from the origin remote.
func IsVaultTracked ¶
IsVaultTracked reports whether .envault/config is known to git (i.e., the vault was cloned from a remote rather than only created locally). When this returns false the vault files are untracked and were never committed.
func MergeOrigin ¶
MergeOrigin merges origin/<current-branch> into HEAD. Fast-forwards when possible; creates a merge commit for diverged histories. Returns ErrMergeConflict when the merge leaves unresolved conflicts so the caller can apply application-level resolution before calling ContinueMerge or AbortMerge.
func PushOrigin ¶
PushOrigin pushes HEAD to the origin remote.
Types ¶
This section is empty.