Fix go-git Compilation and Import Ordering

Claude Code·Opus 4.8[1m]·pjbgf·1mo ago·2hr·3 Checkpoints·7 file changes·+37/-13·104.1K tokens

Fix the compilation issues due to go-git bump.

1mo ago·4m·25 calls

With an isolated git config the entire suite passes. Done.

Summary

The go-git bump (v6.0.0-alpha.4.0.20260521......20260713100844-d5e9b9c7895b) added a protocol.Version parameter to transport.AdvertiseRefs. Its new signature:

Three test-only git-server helpers called the old 5-arg form. I fixed each by adding the protocol import and passing protocol.V0 (the classic v0/v1 info/refs advertisement these helpers serve, preserving prior behavior):

  • client_test.go:186
  • cmd/git-sync/main_test.go:814
  • internal/syncer/integration_test.go:3776

go build ./... and go vet ./... now pass, and the full test suite passes.

Note on the test failures you'd otherwise see: a batch of tests fail with cannot auto-sign commit: disable commit.gpgSign or register an ObjectSigner plugin (and the SSH shim test with agent refused operation). These are not caused by the bump — they reproduce identically on the pre-bump go.mod and stem from your global commit.gpgSign=true / gpg.format=ssh config leaking into go-git's in-memory commits. Running with an isolated git config (GIT_CONFIG_GLOBAL=/dev/null GIT_CONFIG_SYSTEM=/dev/null) makes the whole suite green.

The style hints flagged in integration_test.go (CutPrefix, min, slices.Contains) are pre-existing and unrelated — I left them alone.

Fix the linting issues:

[lint:shellcheck] Finished in 171.1ms [lint:gofmt] These .go files need to be formatted: [lint:gofmt] [lint:gofmt] client_test.go [lint:gofmt] [lint:gofmt] To fix: mise run fmt Finished in 179.5ms [lint:gofmt] ERROR task failed Error: Process completed with exit code 1.

1mo ago·9.9s·2 calls

Fixed. The protocol import was out of alphabetical order; gofmt -w corrected it. gofmt -l now reports the file as clean.

commit change

1mo ago·42.0s·4 calls

Committed as 039dfc5. Working tree is clean.

The version of the model being used that is added as a Assisted-By trailer seems incorrect. Fix that in the claude attribution file.

1mo ago·30.2s·3 calls

Fixed — the attribution in /home/coder/.claude/settings.json now reads Claude Opus 4.8.

Note: the commit I just made (039dfc5) still carries the old Claude Opus 4.7 trailer. It hasn't been pushed yet, so I can amend it to 4.8 if you'd like — want me to?

go ahead

1mo ago·37.8s·1 call

The signing agent refused the operation — your SSH signing key needs unlocking (the agent-timeout situation your CLAUDE.md notes). Once you've unlocked it, tell me and I'll re-run the amend. The staged message is ready with the corrected Claude Opus 4.8 trailer.

try agian

1mo ago·42.2s·1 call

Done. Amended to 5da218a with the corrected Assisted-by: Claude Opus 4.8 trailer, now properly signed.

Update tests so that they ignore system/global level config settings (e.g. commit.gpgSign=true)

1mo ago·7m·38 calls

Done. All tests now ignore system/global git config, verified with the developer's real commit.gpgSign=true still active.

What I did

The root cause: go-git's x/plugin registers xconfig.NewAuto() as the default ConfigLoader at init time, which reads the host's real ~/.gitconfig and /etc/gitconfig. That pulled commit.gpgSign=true into every go-git in-memory commit, and the real git binary in the SSH tests read it independently.

Rather than the go-git-only plugin override that internal/syncer was already using (which left the SSH test broken), I used a single mechanism that both go-git's loader and the git binary honor: GIT_CONFIG_GLOBAL/GIT_CONFIG_SYSTEM pointed at os.DevNull.

  • internal/syncertest/repo.go — added IsolateGitConfig(), which sets those two env vars. Documented why it uses os.Setenv (the suites use t.Parallel(), which forbids t.Setenv), so it must be called from TestMain.
  • client_test.go (root gitsync) — added a TestMain calling it.
  • internal/strategy/materialized/materialized_test.go — added a TestMain calling it.
  • cmd/git-sync/main_test.go — added the call to the existing TestMain.
  • internal/syncer/integration_test.go — replaced the go-git-only plugin registration with IsolateGitConfig() (this also fixes the SSH shim test), dropped the now-unused x/plugin and x/plugin/config imports, and switched m.Run()os.Exit(m.Run()) so failures actually propagate.

The remaining lint hints in integration_test.go/materialized_test.go (CutPrefix, min, slices.Contains) are pre-existing and unrelated — I left them untouched. Nothing is committed yet.

commit changes

1mo ago·44.3s·2 calls

The signing agent refused again — your SSH signing key needs unlocking. Once you've unlocked it, say the word and I'll re-run the commit (changes are already staged).

go ahead and comit

1mo ago·15.7s·1 call

Committed as 2f730b7, signed successfully. Working tree is clean.