3c8f73c312d1639826a3a5cc499197f423508833

Author
Marc Cornellà <marc.cornella@live.com>
Committer
Marc Cornellà <marc.cornella@live.com>
Date

Message

git-prompt: fix LANG override for git status call

The previous version modified the whole environment leading to
problems (see #7757). This version *adds* LANG=C to the current
env, without overriding it completely.

Fixes #7757.

Diff

 1diff --git a/plugins/git-prompt/gitstatus.py b/plugins/git-prompt/gitstatus.py
 2index 5243af23c80a46ffdfb41c243530dc1144c1f29c..390a50a6f491804a5b8d10f5f5a5a26ffa753fe8 100644
 3--- a/plugins/git-prompt/gitstatus.py
 4+++ b/plugins/git-prompt/gitstatus.py
 5@@ -1,6 +1,7 @@
 6 #!/usr/bin/env python
 7 from __future__ import print_function
 8 
 9+import os
10 import sys
11 import re
12 import shlex
13@@ -30,7 +31,7 @@ def get_tagname_or_hash():
14 
15 # `git status --porcelain --branch` can collect all information
16 # branch, remote_branch, untracked, staged, changed, conflicts, ahead, behind
17-po = Popen(['git', 'status', '--porcelain', '--branch'], env={"LANG": "C"}, stdout=PIPE, stderr=PIPE)
18+po = Popen(['git', 'status', '--porcelain', '--branch'], env=dict(os.environ, LANG="C"), stdout=PIPE, stderr=PIPE)
19 stdout, sterr = po.communicate()
20 if po.returncode != 0:
21     sys.exit(0)  # Not a git repository