Go library extracted from git-fire: subprocess-oriented git helpers and small safety utilities.
Module: github.com/git-fire/git-harness
git— repository scanning, status, commits, pushes, worktrees, and related helpers.safety— redaction and secret-pattern scanning helpers used by git error paths.
Python and Java clients use the same layout as git-testkit under testkit/: build cmd/git-harness-cli, set GIT_HARNESS_CLI to that binary (or rely on go run ./cmd/git-harness-cli from the repo root). Code lives in testkit/python and testkit/java; runnable samples are testkit/python/samples/ and the Java Sample*Smoke tests.
- Go 1.24+ (see
go.mod). gitonPATHfor tests and runtime (package shells out to the git binary).
go build ./...
go vet ./...
go test -race -count=1 ./...The git package now includes bounded multi-pass rewrite orchestration via
RunRewriteScenario, designed for flows that must:
- Detect whether intervention is needed.
- Intervene (run one rewrite pass).
- Verify the repo is clean.
- Rerun from detect until clean or attempts are exhausted.
Use it for safety-first rewrite loops where you need deterministic stop
conditions and pass-by-pass telemetry (RewriteScenarioResult.Passes).
# Targeted rewrite orchestration tests
go test -count=1 ./git -run RunRewriteScenario
# Full module sanity
go test -count=1 ./...Expected outcome:
- Targeted run:
ok github.com/git-fire/git-harness/git ... - Full run: all packages return
okwith no failing tests - If a rewrite loop never reaches clean within
MaxAttempts, callers receiveErrRewriteAttemptsExceeded
v0.x releases may change APIs; pin a minor or patch version in consumers.
MIT — see LICENSE.