summaryrefslogtreecommitdiffstats
path: root/git_command.py
diff options
context:
space:
mode:
authorShawn O. Pearce <sop@google.com>2011-01-09 17:29:50 -0800
committerShawn O. Pearce <sop@google.com>2011-01-09 17:29:50 -0800
commit71cab95b4cc6758d5f18f19412188d46d0a29190 (patch)
tree0699635c5d912ea523747be299766f5cab9180b3 /git_command.py
parent9275fd43294e760e47736857113f32a2f189c6c6 (diff)
parentf18cb761731a791bf1b9ee8c6308bfce5c9d3e62 (diff)
downloadgit-repo-71cab95b4cc6758d5f18f19412188d46d0a29190.tar.gz
Merge branch 'stable'
* stable: Encode the environment variables passed to git Exit with statuscode 0 for repo help init
Diffstat (limited to 'git_command.py')
-rw-r--r--git_command.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/git_command.py b/git_command.py
index 181e3724..513b9ebf 100644
--- a/git_command.py
+++ b/git_command.py
@@ -112,6 +112,9 @@ def git_require(min_version, fail=False):
112 sys.exit(1) 112 sys.exit(1)
113 return False 113 return False
114 114
115def _setenv(env, name, value):
116 env[name] = value.encode()
117
115class GitCommand(object): 118class GitCommand(object):
116 def __init__(self, 119 def __init__(self,
117 project, 120 project,
@@ -137,10 +140,10 @@ class GitCommand(object):
137 del env[e] 140 del env[e]
138 141
139 if disable_editor: 142 if disable_editor:
140 env['GIT_EDITOR'] = ':' 143 _setenv(env, 'GIT_EDITOR', ':')
141 if ssh_proxy: 144 if ssh_proxy:
142 env['REPO_SSH_SOCK'] = ssh_sock() 145 _setenv(env, 'REPO_SSH_SOCK', ssh_sock())
143 env['GIT_SSH'] = _ssh_proxy() 146 _setenv(env, 'GIT_SSH', _ssh_proxy())
144 147
145 if project: 148 if project:
146 if not cwd: 149 if not cwd:
@@ -151,7 +154,7 @@ class GitCommand(object):
151 command = [GIT] 154 command = [GIT]
152 if bare: 155 if bare:
153 if gitdir: 156 if gitdir:
154 env[GIT_DIR] = gitdir 157 _setenv(env, GIT_DIR, gitdir)
155 cwd = None 158 cwd = None
156 command.extend(cmdv) 159 command.extend(cmdv)
157 160