Documentation
¶
Overview ¶
Package gitfixture provides go-git-backed test fixtures (a fixed commit signature, a fresh repo, and a write+commit helper) for awf's test suites that need a real git repository. It is kept separate from internal/testsupport so a caller that only needs e.g. testsupport.WriteFile does not have to pull go-git into its test binary (ADR-0044).
Index ¶
- Variables
- func Commit(t *testing.T, repo *git.Repository, dir, msg string, write map[string]string, ...) plumbing.Hash
- func InitRepo(t *testing.T) (*git.Repository, string)
- func Merge(t *testing.T, repo *git.Repository, msg string, parents ...plumbing.Hash) plumbing.Hash
- func Stage(t *testing.T, repo *git.Repository, dir string, write map[string]string)
Constants ¶
This section is empty.
Variables ¶
var Sig = &object.Signature{Name: "T", Email: "t@example.com", When: time.Date(2026, 1, 1, 0, 0, 0, 0, time.UTC)}
Sig is the fixed commit signature used by InitRepo/Commit fixtures across awf's test suites.
Functions ¶
func Commit ¶
func Commit(t *testing.T, repo *git.Repository, dir, msg string, write map[string]string, remove ...string) plumbing.Hash
Commit writes/removes the given paths in repo's worktree (rooted at dir), stages them, and commits with Sig, returning the commit hash.
func InitRepo ¶
func InitRepo(t *testing.T) (*git.Repository, string)
InitRepo creates a fresh git repository in a new t.TempDir(), returning the repository and its root path.
func Merge ¶ added in v0.22.0
Merge creates a merge commit whose tree is the current index, with the given parents in order (the first is the first parent), so a fixture can exercise first-parent range semantics. It allows an empty commit, so a merge can integrate a branch whose tree already matches HEAD.
Types ¶
This section is empty.