Skip to content

refactor(git): include the agent config instead of replacing the global one - #52

Merged
potsrevennil merged 1 commit into
mainfrom
refactor/agent-gitconfig-include
Oct 20, 2026
Merged

potsrevennil merged 1 commit into
mainfrom
refactor/agent-gitconfig-include

Conversation

@potsrevennil

Copy link
Copy Markdown
Owner

PR #51 loads the agent git config through GIT_CONFIG_GLOBAL, which replaces the global config. That forced a Nix store copy at ~/.config/git-agent/config: otherwise a missing file (an older branch in the main checkout) would silently drop the whole global config, identity included. It also put an extra folder next to ~/.config/git.

This loads it as an include from the environment instead (GIT_CONFIG_COUNT=1, GIT_CONFIG_KEY_0=include.path, GIT_CONFIG_VALUE_0=~/.config/git/agent.gitconfig, set in ~/.claude/settings.json). The normal global config keeps loading. A missing file is skipped, so agents just get plain git. git config --global writes the normal config, as in a terminal. So the file stays in the version-controlled ~/.config/git folder symlink, the git-agent store copy goes, and agent.gitconfig no longer includes the normal config itself.

  • Look at: include scope. An env-provided include ranks above a repo's own .git/config, so agent.gitconfig must hold only output settings, never identity or editor. That's also why the old [include] of the normal config is removed.
  • Verify:
    GIT_CONFIG_COUNT=1 GIT_CONFIG_KEY_0=include.path GIT_CONFIG_VALUE_0=$PWD/users/home/git/agent.gitconfig git status
    GIT_CONFIG_COUNT=1 GIT_CONFIG_KEY_0=include.path GIT_CONFIG_VALUE_0=/nonexistent git config user.email
    The first prints short status; the second still prints your email.
  • After merge: pull the main checkout (no make home needed for the file; make home removes the stale ~/.config/git-agent), then add the three env entries to ~/.claude/settings.json.

🤖 Generated with Claude Code

…al one

Load users/home/git/agent.gitconfig through an env-provided include.path
(GIT_CONFIG_COUNT/KEY/VALUE in ~/.claude/settings.json) instead of
GIT_CONFIG_GLOBAL. The normal global config keeps loading, a missing file
is skipped rather than dropping the whole global config and identity
with it, and `git config --global` writes the normal config. That makes
the Nix store copy at ~/.config/git-agent unnecessary, so the file stays
in the version-controlled ~/.config/git folder symlink.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@potsrevennil
potsrevennil marked this pull request as ready for review October 20, 2026 06:36
@potsrevennil
potsrevennil merged commit c7043e9 into main Oct 20, 2026
7 checks passed
@potsrevennil
potsrevennil deleted the refactor/agent-gitconfig-include branch October 20, 2026 06:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant