Push language override down into the cmd wrapper

There are more things that break if we run git with i18n on. Make sure
that we always set LANG and LANGUAGE to C so that we get predictable
output.

Change-Id: I1bf1124f0b09d6658a7b0703e3b9e74ed80f4eea
This commit is contained in:
Monty Taylor 2015-05-04 13:07:14 -04:00
parent f4f6674c9c
commit a13b7a9d77
1 changed files with 3 additions and 1 deletions

View File

@ -133,6 +133,8 @@ def run_command_status(*argv, **kwargs):
argv = shlex.split(str(argv[0]))
stdin = kwargs.pop('stdin', None)
newenv = os.environ.copy()
newenv['LANG'] = 'C'
newenv['LANGUAGE'] = 'C'
newenv.update(kwargs)
p = subprocess.Popen(argv,
stdin=subprocess.PIPE if stdin else None,
@ -814,7 +816,7 @@ def get_branch_name(target_branch):
has_color = check_color_support()
if has_color:
cmd += " --color=never"
for branch in run_command(cmd, LANG='C').split("\n"):
for branch in run_command(cmd).split("\n"):
if branch.startswith('*'):
_branch_name = branch.split()[1].strip()
break