fix(core): add explicit git identity env vars to prevent sandbox checkpointing error (#19775)

Co-authored-by: David Pierce <davidapierce@google.com>
This commit is contained in:
MD. MOHIBUR RAHMAN
2026-04-09 23:24:04 +06:00
committed by GitHub
parent b238a453e3
commit 5bcb6b619d
2 changed files with 21 additions and 5 deletions
+10 -3
View File
@@ -13,7 +13,11 @@ import {
afterEach,
type Mock,
} from 'vitest';
import { GitService } from './gitService.js';
import {
GitService,
SHADOW_REPO_AUTHOR_NAME,
SHADOW_REPO_AUTHOR_EMAIL,
} from './gitService.js';
import { Storage } from '../config/storage.js';
import * as path from 'node:path';
import * as fs from 'node:fs/promises';
@@ -192,8 +196,7 @@ describe('GitService', () => {
const service = new GitService(projectRoot, storage);
await service.setupShadowGitRepository();
const expectedConfigContent =
'[user]\n name = Gemini CLI\n email = gemini-cli@google.com\n[commit]\n gpgsign = false\n';
const expectedConfigContent = `[user]\n name = ${SHADOW_REPO_AUTHOR_NAME}\n email = ${SHADOW_REPO_AUTHOR_EMAIL}\n[commit]\n gpgsign = false\n`;
const actualConfigContent = await fs.readFile(gitConfigPath, 'utf-8');
expect(actualConfigContent).toBe(expectedConfigContent);
});
@@ -288,6 +291,10 @@ describe('GitService', () => {
expect.objectContaining({
GIT_CONFIG_GLOBAL: gitConfigPath,
GIT_CONFIG_SYSTEM: path.join(repoDir, '.gitconfig_system_empty'),
GIT_AUTHOR_NAME: SHADOW_REPO_AUTHOR_NAME,
GIT_AUTHOR_EMAIL: SHADOW_REPO_AUTHOR_EMAIL,
GIT_COMMITTER_NAME: SHADOW_REPO_AUTHOR_NAME,
GIT_COMMITTER_EMAIL: SHADOW_REPO_AUTHOR_EMAIL,
}),
);