Context
Follow-up from #13184 / PR #13185. Review feedback from PR #13171 requested replacing real git usage in publish tests with run.CommandStubber.
This was deferred because it touches 20+ test cases and is better handled as a focused refactor.
Task
Convert all real exec.Command("git", ...) usage in pkg/cmd/skills/publish/publish_test.go to use run.Stub() / run.CommandStubber:
- Replace
initGitRepo helper (creates real git repos with bare remotes) with command stubs for git remote -v, git config --get-regexp, git remote get-url, etc.
- Replace
newTestGitClientWithUpstream helper with stubs for git symbolic-ref, git rev-list, git push
- Replace
runGitInDir helper and all direct exec.Command calls
- Convert
TestEnsurePushed test cases to verify correct git commands are called via stubs
- Convert inline git init/config/check-ignore calls in test setups
Prior art
Context
Follow-up from #13184 / PR #13185. Review feedback from PR #13171 requested replacing real git usage in publish tests with
run.CommandStubber.This was deferred because it touches 20+ test cases and is better handled as a focused refactor.
Task
Convert all real
exec.Command("git", ...)usage inpkg/cmd/skills/publish/publish_test.goto userun.Stub()/run.CommandStubber:initGitRepohelper (creates real git repos with bare remotes) with command stubs forgit remote -v,git config --get-regexp,git remote get-url, etc.newTestGitClientWithUpstreamhelper with stubs forgit symbolic-ref,git rev-list,git pushrunGitInDirhelper and all directexec.CommandcallsTestEnsurePushedtest cases to verify correct git commands are called via stubsPrior art
pkg/cmd/pr/create/create_test.golines 1580-1589 —run.Stub()setuppkg/cmd/pr/create/create_test.golines 737-746 —cs.Registerexamples