Skip to main content

Module git

Module git 

Source
Expand description

Thin git shell-out helpers.

Aristo deliberately avoids pulling in git2 / gix — those are heavy dependencies for a handful of operations. We invoke the user’s git binary on the system PATH and parse its stdout. The invocations here are intentionally narrow:

  • rev_parse_head resolves HEAD to a 40-char SHA.
  • commit_present_on_remote checks whether a commit SHA appears on any origin/* ref via git branch -r --contains <sha>. Used by the canon-verify push-first precheck (per WORKFLOW.md §4 + §7c “Push-first; mutagen later”).

Tests use real git init against a tempdir — the small extra cost (≈ tens of ms per test) buys actual coverage of the shell-out path. There’s no point mocking Command::output() here.

Enums§

GitError
Errors surfaced by the git shell-outs.

Functions§

commit_present_on_remote
True iff commit_sha appears on at least one origin/* remote- tracking branch (the SDK’s push-first precheck).
rev_parse_head
Run git rev-parse HEAD in workspace_root and return the resolved 40-char (or 64-char SHA-256) SHA.