{{ message }}
Repository navigation
fix(agent): forward repo-local git identity into docker sandbox - #76
Merged
Merged
Conversation
Resolve user.name/user.email against the run's working directory instead of --global, so a repo-local identity (or a matching includeIf) wins over the global one. The forwarded GIT_* env vars override every config file in the container, so a global-only lookup silently masked repo config.
Run the config lookup against an isolated global config (GIT_CONFIG_GLOBAL, GIT_CONFIG_NOSYSTEM) to cover repo-local precedence, global fallback, includeIf matching the workdir, nothing configured, and worktrees picking up the main repo's identity.
Pass git forward-slash paths without the \\?\ verbatim prefix that canonicalize returns on Windows, since gitconfig values treat backslashes as escapes, and match gitdir case-insensitively.
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.

Problem
Docker sandbox runs forward the host's git identity as
GIT_AUTHOR_*/GIT_COMMITTER_*env vars, read withgit config --global. Inside the container those env vars beat every config file. So a repo that sets its ownuser.name/user.email(for example a work email) still got commits signed with the global identity.Fix
host_git_confignow runsgit -C <workdir> config --get <key>. Git resolves it the same waygit commitwould on the host: worktree config first, then repo-local, then global (includingincludeIfsections that match the workdir), then system.--worktreeruns pick up the main repo's identity. Identity set in a profile's env vars still wins, and only the identity is forwarded, never the host.gitconfigitself.Tests
GIT_CONFIG_GLOBALwithGIT_CONFIG_NOSYSTEM), so they never read the real gitconfig. They cover repo-local beating global, falling back to global,includeIf gitdir:, nothing configured, and a worktree reading the main repo's identity.cargo testpasses in full (625 + 25 + 33), and clippy reports no new warnings.