@@ -8,7 +8,7 @@ import { writeFileSync } from "node:fs";
88import { join } from "node:path" ;
99
1010import { registerGitPushTool } from "./git-push-tool.js" ;
11- import { captureTool , cleanupTmpPaths , mkTmpDir } from "./test-harness.js" ;
11+ import { captureTool , cleanupTmpPaths , mkTmpDir , writeTestGitConfig } from "./test-harness.js" ;
1212
1313afterEach ( cleanupTmpPaths ) ;
1414
@@ -33,9 +33,7 @@ function makeRepoWithRemote(): { dir: string; remote: string } {
3333 const dir = mkTmpDir ( "mcp-git-push-test-" ) ;
3434 const remote = mkTmpDir ( "mcp-git-push-remote-" ) ;
3535 gitCmd ( dir , "init" , "-b" , "main" ) ;
36- gitCmd ( dir , "config" , "user.email" , "test@example.com" ) ;
37- gitCmd ( dir , "config" , "user.name" , "Test User" ) ;
38- gitCmd ( dir , "config" , "commit.gpgsign" , "false" ) ;
36+ writeTestGitConfig ( dir ) ;
3937 writeFileSync ( join ( dir , "base.ts" ) , "const b = 0;\n" ) ;
4038 gitCmd ( dir , "add" , "base.ts" ) ;
4139 gitCmd ( dir , "commit" , "-m" , "chore: base" ) ;
@@ -79,9 +77,7 @@ describe("git_push", () => {
7977 const dir = mkTmpDir ( "mcp-git-push-set-upstream-" ) ;
8078 const remote = mkTmpDir ( "mcp-git-push-set-upstream-remote-" ) ;
8179 gitCmd ( dir , "init" , "-b" , "feature/new" ) ;
82- gitCmd ( dir , "config" , "user.email" , "test@example.com" ) ;
83- gitCmd ( dir , "config" , "user.name" , "Test User" ) ;
84- gitCmd ( dir , "config" , "commit.gpgsign" , "false" ) ;
80+ writeTestGitConfig ( dir ) ;
8581 writeFileSync ( join ( dir , "base.ts" ) , "const b = 0;\n" ) ;
8682 gitCmd ( dir , "add" , "base.ts" ) ;
8783 gitCmd ( dir , "commit" , "-m" , "chore: base" ) ;
@@ -115,9 +111,7 @@ describe("git_push", () => {
115111 test ( "push_no_upstream when no tracking configured" , async ( ) => {
116112 const dir = mkTmpDir ( "mcp-git-push-no-upstream-" ) ;
117113 gitCmd ( dir , "init" , "-b" , "main" ) ;
118- gitCmd ( dir , "config" , "user.email" , "test@example.com" ) ;
119- gitCmd ( dir , "config" , "user.name" , "Test User" ) ;
120- gitCmd ( dir , "config" , "commit.gpgsign" , "false" ) ;
114+ writeTestGitConfig ( dir ) ;
121115 writeFileSync ( join ( dir , "base.ts" ) , "const b = 0;\n" ) ;
122116 gitCmd ( dir , "add" , "base.ts" ) ;
123117 gitCmd ( dir , "commit" , "-m" , "chore: base" ) ;
@@ -132,9 +126,7 @@ describe("git_push", () => {
132126 test ( "push_detached_head when HEAD is detached" , async ( ) => {
133127 const dir = mkTmpDir ( "mcp-git-push-detached-" ) ;
134128 gitCmd ( dir , "init" , "-b" , "main" ) ;
135- gitCmd ( dir , "config" , "user.email" , "test@example.com" ) ;
136- gitCmd ( dir , "config" , "user.name" , "Test User" ) ;
137- gitCmd ( dir , "config" , "commit.gpgsign" , "false" ) ;
129+ writeTestGitConfig ( dir ) ;
138130 writeFileSync ( join ( dir , "base.ts" ) , "const b = 0;\n" ) ;
139131 gitCmd ( dir , "add" , "base.ts" ) ;
140132 gitCmd ( dir , "commit" , "-m" , "chore: base" ) ;
0 commit comments