Merge pull request #572: fix(git): pin git's locale for clone, so failures classify on non-English hosts (#568)

This commit is contained in:
Codeman maintainer
2026-10-10 02:53:25 +02:00
4 changed files with 16 additions and 2 deletions
+4
View File
@@ -495,6 +495,10 @@ export function gitNonInteractiveEnv(base: NodeJS.ProcessEnv = process.env): Nod
SSH_ASKPASS_REQUIRE: 'never', SSH_ASKPASS_REQUIRE: 'never',
DISPLAY: '', DISPLAY: '',
GCM_INTERACTIVE: 'never', GCM_INTERACTIVE: 'never',
// classifyGitFailure() matches git's ENGLISH stderr; a German or French locale would
// turn a missing ref into a generic FAILED (422 instead of 400).
LC_ALL: 'C',
LANG: 'C',
GIT_SSH_COMMAND: GIT_SSH_COMMAND:
base.GIT_SSH_COMMAND || 'ssh -oBatchMode=yes -oStrictHostKeyChecking=accept-new -oConnectTimeout=10', base.GIT_SSH_COMMAND || 'ssh -oBatchMode=yes -oStrictHostKeyChecking=accept-new -oConnectTimeout=10',
}; };
+2 -2
View File
@@ -1342,8 +1342,8 @@ describe('Custom Model Endpoint Profiles: _confirmContextWarning (in-app modal,
expect(modal.classList.contains('active')).toBe(true); expect(modal.classList.contains('active')).toBe(true);
const message = win.document.getElementById('customModelContextWarningMessage')!.textContent!; const message = win.document.getElementById('customModelContextWarningMessage')!.textContent!;
expect(message).toContain('qwen3.8-27b-ud-q4_k_xl'); expect(message).toContain('qwen3.8-27b-ud-q4_k_xl');
expect(message).toContain('16,384'); expect(message).toContain((16384).toLocaleString()); // the modal formats for the user's locale
expect(message).toContain('40,000'); expect(message).toContain((40000).toLocaleString());
expect(message).toMatch(/llama-swap/i); expect(message).toMatch(/llama-swap/i);
expect(message).toMatch(/fit-ctx/i); expect(message).toMatch(/fit-ctx/i);
+8
View File
@@ -239,6 +239,14 @@ describe('gitNonInteractiveEnv', () => {
it("does not override a user's own GIT_SSH_COMMAND", () => { it("does not override a user's own GIT_SSH_COMMAND", () => {
expect(gitNonInteractiveEnv({ GIT_SSH_COMMAND: 'ssh -F /custom' }).GIT_SSH_COMMAND).toBe('ssh -F /custom'); expect(gitNonInteractiveEnv({ GIT_SSH_COMMAND: 'ssh -F /custom' }).GIT_SSH_COMMAND).toBe('ssh -F /custom');
}); });
// Issue #568. CI runs in an English locale, so the real-git tests below cannot
// catch a revert: only this assertion fails if the pin is dropped.
it("pins git's messages to English over the host's locale, since classifyGitFailure() matches English stderr", () => {
const env = gitNonInteractiveEnv({ LC_ALL: 'de_DE.UTF-8', LANG: 'de_DE.UTF-8', LANGUAGE: 'de' });
expect(env.LC_ALL).toBe('C');
expect(env.LANG).toBe('C');
});
}); });
describe('parseLsRemoteOutput', () => { describe('parseLsRemoteOutput', () => {
+2
View File
@@ -14,6 +14,8 @@ import { clearGitStatusCache, runGit, type GitRunner } from '../../src/git-works
const ENV = { const ENV = {
...process.env, ...process.env,
// As the production runner (git-workspace-status.ts): git's not-a-repo message is matched in English.
LC_ALL: 'C',
GIT_AUTHOR_NAME: 'T', GIT_AUTHOR_NAME: 'T',
GIT_AUTHOR_EMAIL: 't@example.com', GIT_AUTHOR_EMAIL: 't@example.com',
GIT_COMMITTER_NAME: 'T', GIT_COMMITTER_NAME: 'T',