Skip to content

Force the C locale for GVFS Git subprocesses - #2178

Merged
Tyrie Vella (tyrielv) merged 2 commits into
masterfrom
tyrielv/git-locale-policy
Nov 12, 2026
Merged

Tyrie Vella (tyrielv) merged 2 commits into
masterfrom
tyrielv/git-locale-policy

Conversation

@tyrielv

@tyrielv Tyrie Vella (tyrielv) commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

Problem and Context

GVFS parses English Git diagnostics to classify configuration errors and recover from corrupt objects or maintenance failures. Git can translate these diagnostics when inherited locale variables select another language. Translated diagnostics can prevent retries or recovery, or cause GVFS to reject a clean worktree.

Changes

  • Add a shared Git subprocess factory that sets LC_ALL=C in the child environment. This also suppresses gettext translations selected by LANGUAGE.
  • Use the factory for normal GitProcess calls, alias queries, worktree status, and worktree checkout. Keep existing arguments, authentication behavior, environment overrides, and process flags.
  • Share process setup between ProcessHelper.Run and ProcessHelper.RunGit. Worktree status and checkout use RunGit, so they no longer duplicate process flags.
  • Preserve the existing LC_ALL=C override for raw configuration reads.
  • Add unit tests for absent and non-English inherited LC_ALL with non-English LANGUAGE. The tests verify parent-environment preservation and alias-query inheritance. The GitProcess test runs a real Git child that reports its locale through a command-scoped shell alias.
  • Add unit tests for captured and inherited output in both execution helpers. These tests verify the Git-specific locale override and the inherited locale for generic execution.

Set LC_ALL=C in a shared Git subprocess factory so translated diagnostics
do not bypass English error classifiers. Use the factory for GitProcess
and standalone hook launchers without changes to their process flags.

Add unit tests for inherited locale variables, parent-environment
preservation, and the locale of a real Git child.

Assisted-by: GPT-6.1 Sol
Signed-off-by: Tyrie Vella <[email protected]>
Add ProcessHelper.RunGit and share process setup with the generic Run
helper. Use RunGit for worktree status and checkout so the hooks do not
duplicate process flags or require a new project reference.

Add unit tests for locale preservation and both output-redirection modes.

Assisted-by: GPT-6.1 Sol
Signed-off-by: Tyrie Vella <[email protected]>
@tyrielv
Tyrie Vella (tyrielv) marked this pull request as ready for review November 12, 2026 17:19
@KeithIsSleeping

Copy link
Copy Markdown

[KeithBot]: ✅ No issues found · iteration 1 (c1c381e)

Approach: Right layer: one LC_ALL=C factory in ProcessHelper serves GitProcess.GetGitProcess and the hooks' three Git launches, so every English-text Git classifier is covered by a single policy.

Validation

  • ⚠️ CI run 43267484263 (unit + functional) — partial
  • ✅ Full unit suite at head + merge base
  • ✅ Changed fixtures 118/118 on 3 Gits
  • ✅ Mutants killed by the new tests
  • ✅ Real-git gettext probes, head vs base
  • ✅ Worktree hooks + non-ASCII side effects
  • ✅ NativeAOT probe, consumers, CLI tests
  • ⏭️ Mounted functional tests locally — not run

Approving.

🤖 KeithBot · claude-opus-5.5, gpt-6.1-sol, gemini-4-argon + approach review · reply on a thread to dispute

@tyrielv
Tyrie Vella (tyrielv) merged commit b5b3ecb into master Nov 12, 2026
71 of 73 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants