test(import): fully isolate git config in author fallback test#1849
Merged
Conversation
TestRun_UnconfiguredGitIdentityFallsBackToDefaults overrode only HOME and XDG_CONFIG_HOME, but GetGitAuthorFromRepo resolves GlobalScope through go-git's Auto loader, which also honors GIT_CONFIG_GLOBAL and system /etc/gitconfig. On any machine/CI where one of those carries a git identity the "Unknown"/"unknown@local" assertion would flake. Neutralize every global source the way the checkpoint package's pointHomeAt helper already does: set GIT_CONFIG_NOSYSTEM=1 and unset GIT_CONFIG_GLOBAL. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Entire-Checkpoint: 01KY9MM18RHEBYFH4Y4QVJK7RT
Contributor
There was a problem hiding this comment.
Pull request overview
Hardens entire import’s author-fallback unit test so it’s fully isolated from any host/global Git identity configuration, preventing flakes caused by go-git’s global config resolution behavior.
Changes:
- Expanded the test comment to document why additional git config isolation is required.
- In
TestRun_UnconfiguredGitIdentityFallsBackToDefaults, setGIT_CONFIG_NOSYSTEM=1and explicitly unsetGIT_CONFIG_GLOBAL(while still restoring it after the test viat.Setenv).
3 tasks
pjbgf
approved these changes
Jul 24, 2026
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.
https://entire.io/gh/entireio/cli/trails/935
Stacked on #1846.
Summary
Copilot flagged that
TestRun_UnconfiguredGitIdentityFallsBackToDefaults(added in #1846) only overridesHOME/XDG_CONFIG_HOME. Butcheckpoint.GetGitAuthorFromReporesolvesGlobalScopethrough go-git's Auto loader, which also honorsGIT_CONFIG_GLOBALand the system/etc/gitconfig. On any dev machine or CI image where either carries a git identity (e.g.GIT_CONFIG_GLOBALset by chezmoi/direnv — the same dotfile-tool setupsconfigloader.goexists to handle), theUnknown/unknown@localassertion would flake.The fix neutralizes every global source, matching the checkpoint package's own
pointHomeAthelper (checkpoint/configloader_test.go:52,checkpoint/global_test.go:39):GIT_CONFIG_NOSYSTEM=1— skip/etc/gitconfigGIT_CONFIG_GLOBAL— fall back to XDG (empty value would disable global config entirely, so it is unset, not emptied)Production code is unchanged; this is test-isolation hardening only. The sibling
TestRun_StampsImporterGitAuthorOnCheckpointCommitwas never at risk — it uses repo-local identity, which wins go-git's config merge regardless of global/system.Test plan
go test ./cmd/entire/cli/agentimport/ -run 'TestRun_Unconfigured...|TestRun_Stamps...' -count=1greengolangci-lint(v2.11.3)0 issues🤖 Generated with Claude Code
Note
Low Risk
Test-only comment and environment setup; no runtime behavior changes.
Overview
Hardens
TestRun_UnconfiguredGitIdentityFallsBackToDefaultsso it no longer flakes when the host has git identity outsideHOME/XDG_CONFIG_HOME.The test now sets
GIT_CONFIG_NOSYSTEM=1and unsetsGIT_CONFIG_GLOBAL(aftert.Setenvfor cleanup), matching the checkpoint package’spointHomeAthelper. That blocks go-git’s global config sources (/etc/gitconfig,GIT_CONFIG_GLOBAL, etc.) soUnknown/unknown@localassertions stay reliable. Comments were expanded to document why full isolation is required.No production code changes — test isolation only.
Reviewed by Cursor Bugbot for commit 3dda7ee. Configure here.