summaryrefslogtreecommitdiff
path: root/git/cmd.py
diff options
context:
space:
mode:
authorDarragh Bailey <dbailey@hp.com>2014-11-17 15:58:04 +0000
committerDarragh Bailey <dbailey@hp.com>2014-11-17 16:30:07 +0000
commit8df6b87a793434065cd9a01fcaa812e3ea47c4dd (patch)
treeb1d2282d0f8a2c221a61297d302668e8553c299d /git/cmd.py
parent2af98929bd185cf1b4316391078240f337877f66 (diff)
downloadgitpython-8df6b87a793434065cd9a01fcaa812e3ea47c4dd.tar.gz
Copy environment for subprocess execution
Git utilizes multiple environment variables to control various behaviours. Make sure to set LC_MESSAGES on a copy of the environment instead of discarding any variables that may be set by the user or default shell environment such as EDITOR. Add test to assert that when overriding GIT_EDITOR via os.environ that the modified value will be picked up by and git commands called.
Diffstat (limited to 'git/cmd.py')
-rw-r--r--git/cmd.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/git/cmd.py b/git/cmd.py
index 9cc6b1fa..f97dd3f6 100644
--- a/git/cmd.py
+++ b/git/cmd.py
@@ -341,8 +341,10 @@ class Git(LazyMixin):
cwd = self._working_dir
# Start the process
+ env = os.environ.copy()
+ env["LC_MESSAGES"] = "C"
proc = Popen(command,
- env={"LC_MESSAGES": "C"},
+ env=env,
cwd=cwd,
stdin=istream,
stderr=PIPE,