Skip to content

[cleanup]Standardize git test repository setup#1390

Open
stale2000 wants to merge 1 commit into
entireio:mainfrom
stale2000:codex/standardize-git-test-setup
Open

[cleanup]Standardize git test repository setup#1390
stale2000 wants to merge 1 commit into
entireio:mainfrom
stale2000:codex/standardize-git-test-setup

Conversation

@stale2000

@stale2000 stale2000 commented Jun 9, 2026

Copy link
Copy Markdown

EntireIO history: https://entire.io/gh/stale2000/cli/session/019ea9ab-7cd3-74c0-aad0-ebd41af014d4

Problem

The repo documents testutil.InitRepo as the default way to initialize git repositories in tests, but many ordinary test fixtures still called git.PlainInit directly. That bypasses the shared test baseline for repo-local identity, disabled GPG signing, and CRLF behavior, which makes tests more sensitive to developer or CI git configuration.

Fix

This conservatively converts normal non-bare test repositories to testutil.InitRepo(t, dir). Tests that still need a *git.Repository reopen the repo with git.PlainOpen(dir) after initialization.

Raw PlainInit remains where it is intentional: bare repositories, no-config/global-author fallback tests, benchmark setup without *testing.T, and package-boundary cases where importing cli/testutil would violate architecture rules.

Verification

  • mise run lint
  • go test ./cmd/entire/cli/strategy ./cmd/entire/cli/checkpoint ./cmd/entire/cli/agent/factoryaidroid
  • go test ./cmd/entire/cli/agent ./cmd/entire/cli/agent/factoryaidroid
  • go test ./cmd/entire/cli -run 'Test(ResolveWorktreeBranch|ResetCmd|Clean|State|Explain|Resume)'

mise run check was also attempted. It gets past lint and the converted packages, but the full suite is currently blocked by an unrelated existing TestRunAuthStatus_RendersSessionsTable auth-date fixture expectation.

Direct go-git PlainInit calls bypassed the repo-local test baseline for identity, signing, and CRLF behavior. This converts ordinary non-bare test repositories to testutil.InitRepo while preserving raw PlainInit for bare repos, author fallback tests, benchmarks, and package-boundary cases where the helper is not appropriate.

Constraint: Existing AGENTS.md requires testutil.InitRepo for initialized test repositories unless lower-level init behavior is under test
Rejected: Convert every PlainInit occurrence | bare repos, no-config author fallback tests, benchmarks, and gitrepo package import boundaries need raw initialization
Confidence: high
Scope-risk: moderate
Directive: Keep raw PlainInit only when the test asserts lower-level git initialization behavior or cannot depend on cli/testutil
Tested: mise run lint; go test ./cmd/entire/cli/strategy ./cmd/entire/cli/checkpoint ./cmd/entire/cli/agent/factoryaidroid; go test ./cmd/entire/cli -run 'Test(ResolveWorktreeBranch|ResetCmd|Clean|State|Explain|Resume)'
Not-tested: Full mise run check is blocked by unrelated TestRunAuthStatus_RendersSessionsTable fixture date expectation
Entire-Checkpoint: 5212b6104998
@stale2000 stale2000 requested a review from a team as a code owner June 9, 2026 00:23
@stale2000 stale2000 changed the title Standardize git test repository setup [cleanup]Standardize git test repository setup Jun 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant