Skip to content

Git commands are expected to run with english language, yet the language isn’t set reliably, breaking features #285409

@flying-sheep

Description

@flying-sheep

Does this issue occur when all extensions are disabled?: Yes

  • VS Code Version: 1.107.1
  • OS Version: Arch Linux (rolling release, so no version)

Steps to Reproduce:

  1. run VS Code with the LANGUAGE environment variable set to something other than en_*, such as de (make sure the locale is enabled in /etc/locale.gen and gen-locale has been run so the data is available)
  2. open a project containing a git repository
  3. modify a file
  4. try to switch git branches

Expected behavior: A popup offering to “migrate changes” to the new branch using git stash

Observed behavior:

A popup informing me that the operation failed, offering only to view logs and command output

The Git extension’s logs show the following (German) output

> git checkout -q pa/pandas-3
Fehler: Ihre lokalen Änderungen in den folgenden Dateien würden beim Auschecken
überschrieben werden:
	src/scanpy/_utils/__init__.py
Bitte committen oder stashen Sie Ihre Änderungen, bevor Sie Branches
wechseln.
Abbruch

More details: This is because of this regex, which expects english command output

if (/Please,? commit your changes or stash them/.test(err.stderr || '')) {

VS Code does set LC_ALL=en_US.UTF-8 and LANG=en_US.UTF-8, but LANGUAGE=de overrides this for software like Git that uses gettext (explained here in gettext’s docs)

LC_ALL: 'en_US.UTF-8',
LANG: 'en_US.UTF-8',

env LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 LANGUAGE=en git -h
usage: […]env LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 LANGUAGE=de git -h
Verwendung: […]

Proposed fix:

also set LANGUAGE=en there.

Metadata

Metadata

Assignees

Labels

bugIssue identified by VS Code Team member as probable buggitGIT issuesinsiders-releasedPatch has been released in VS Code InsidersverifiedVerification succeeded

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions