[cleanup]Standardize git test repository setup#1390
Open
stale2000 wants to merge 1 commit into
Open
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
EntireIO history: https://entire.io/gh/stale2000/cli/session/019ea9ab-7cd3-74c0-aad0-ebd41af014d4
Problem
The repo documents
testutil.InitRepoas the default way to initialize git repositories in tests, but many ordinary test fixtures still calledgit.PlainInitdirectly. 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.Repositoryreopen the repo withgit.PlainOpen(dir)after initialization.Raw
PlainInitremains where it is intentional: bare repositories, no-config/global-author fallback tests, benchmark setup without*testing.T, and package-boundary cases where importingcli/testutilwould violate architecture rules.Verification
mise run lintgo test ./cmd/entire/cli/strategy ./cmd/entire/cli/checkpoint ./cmd/entire/cli/agent/factoryaidroidgo test ./cmd/entire/cli/agent ./cmd/entire/cli/agent/factoryaidroidgo test ./cmd/entire/cli -run 'Test(ResolveWorktreeBranch|ResetCmd|Clean|State|Explain|Resume)'mise run checkwas also attempted. It gets past lint and the converted packages, but the full suite is currently blocked by an unrelated existingTestRunAuthStatus_RendersSessionsTableauth-date fixture expectation.