Browse Source

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
Monty Taylor 4 years ago
parent
commit
a13b7a9d77
1 changed files with 3 additions and 1 deletions
  1. 3
    1
      git_review/cmd.py

+ 3
- 1
git_review/cmd.py View File

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

Loading…
Cancel
Save