diff options
-rw-r--r-- | git_command.py | 22 | ||||
-rw-r--r-- | subcmds/forall.py | 2 | ||||
-rw-r--r-- | subcmds/sync.py | 16 |
3 files changed, 17 insertions, 23 deletions
diff --git a/git_command.py b/git_command.py index 26668a39..a2782151 100644 --- a/git_command.py +++ b/git_command.py | |||
@@ -214,10 +214,6 @@ def git_require(min_version, fail=False, msg=''): | |||
214 | return False | 214 | return False |
215 | 215 | ||
216 | 216 | ||
217 | def _setenv(env, name, value): | ||
218 | env[name] = value.encode() | ||
219 | |||
220 | |||
221 | class GitCommand(object): | 217 | class GitCommand(object): |
222 | def __init__(self, | 218 | def __init__(self, |
223 | project, | 219 | project, |
@@ -237,21 +233,21 @@ class GitCommand(object): | |||
237 | self.tee = {'stdout': not capture_stdout, 'stderr': not capture_stderr} | 233 | self.tee = {'stdout': not capture_stdout, 'stderr': not capture_stderr} |
238 | 234 | ||
239 | if disable_editor: | 235 | if disable_editor: |
240 | _setenv(env, 'GIT_EDITOR', ':') | 236 | env['GIT_EDITOR'] = ':' |
241 | if ssh_proxy: | 237 | if ssh_proxy: |
242 | _setenv(env, 'REPO_SSH_SOCK', ssh_sock()) | 238 | env['REPO_SSH_SOCK'] = ssh_sock() |
243 | _setenv(env, 'GIT_SSH', _ssh_proxy()) | 239 | env['GIT_SSH'] = _ssh_proxy() |
244 | _setenv(env, 'GIT_SSH_VARIANT', 'ssh') | 240 | env['GIT_SSH_VARIANT'] = 'ssh' |
245 | if 'http_proxy' in env and 'darwin' == sys.platform: | 241 | if 'http_proxy' in env and 'darwin' == sys.platform: |
246 | s = "'http.proxy=%s'" % (env['http_proxy'],) | 242 | s = "'http.proxy=%s'" % (env['http_proxy'],) |
247 | p = env.get('GIT_CONFIG_PARAMETERS') | 243 | p = env.get('GIT_CONFIG_PARAMETERS') |
248 | if p is not None: | 244 | if p is not None: |
249 | s = p + ' ' + s | 245 | s = p + ' ' + s |
250 | _setenv(env, 'GIT_CONFIG_PARAMETERS', s) | 246 | env['GIT_CONFIG_PARAMETERS'] = s |
251 | if 'GIT_ALLOW_PROTOCOL' not in env: | 247 | if 'GIT_ALLOW_PROTOCOL' not in env: |
252 | _setenv(env, 'GIT_ALLOW_PROTOCOL', | 248 | env['GIT_ALLOW_PROTOCOL'] = ( |
253 | 'file:git:http:https:ssh:persistent-http:persistent-https:sso:rpc') | 249 | 'file:git:http:https:ssh:persistent-http:persistent-https:sso:rpc') |
254 | _setenv(env, 'GIT_HTTP_USER_AGENT', user_agent.git) | 250 | env['GIT_HTTP_USER_AGENT'] = user_agent.git |
255 | 251 | ||
256 | if project: | 252 | if project: |
257 | if not cwd: | 253 | if not cwd: |
@@ -262,7 +258,7 @@ class GitCommand(object): | |||
262 | command = [GIT] | 258 | command = [GIT] |
263 | if bare: | 259 | if bare: |
264 | if gitdir: | 260 | if gitdir: |
265 | _setenv(env, GIT_DIR, gitdir) | 261 | env[GIT_DIR] = gitdir |
266 | cwd = None | 262 | cwd = None |
267 | command.append(cmdv[0]) | 263 | command.append(cmdv[0]) |
268 | # Need to use the --progress flag for fetch/clone so output will be | 264 | # Need to use the --progress flag for fetch/clone so output will be |
diff --git a/subcmds/forall.py b/subcmds/forall.py index d0e51920..74d1ede7 100644 --- a/subcmds/forall.py +++ b/subcmds/forall.py | |||
@@ -310,8 +310,6 @@ def DoWork(project, mirror, opt, cmd, shell, cnt, config): | |||
310 | def setenv(name, val): | 310 | def setenv(name, val): |
311 | if val is None: | 311 | if val is None: |
312 | val = '' | 312 | val = '' |
313 | if hasattr(val, 'encode'): | ||
314 | val = val.encode() | ||
315 | env[name] = val | 313 | env[name] = val |
316 | 314 | ||
317 | setenv('REPO_PROJECT', project['name']) | 315 | setenv('REPO_PROJECT', project['name']) |
diff --git a/subcmds/sync.py b/subcmds/sync.py index 1988cc72..0ac308e6 100644 --- a/subcmds/sync.py +++ b/subcmds/sync.py | |||
@@ -794,13 +794,13 @@ later is required to fix a server side protocol bug. | |||
794 | if branch.startswith(R_HEADS): | 794 | if branch.startswith(R_HEADS): |
795 | branch = branch[len(R_HEADS):] | 795 | branch = branch[len(R_HEADS):] |
796 | 796 | ||
797 | env = os.environ.copy() | 797 | if 'SYNC_TARGET' in os.environ: |
798 | if 'SYNC_TARGET' in env: | 798 | target = os.environ('SYNC_TARGET') |
799 | target = env['SYNC_TARGET'] | ||
800 | [success, manifest_str] = server.GetApprovedManifest(branch, target) | 799 | [success, manifest_str] = server.GetApprovedManifest(branch, target) |
801 | elif 'TARGET_PRODUCT' in env and 'TARGET_BUILD_VARIANT' in env: | 800 | elif ('TARGET_PRODUCT' in os.environ and |
802 | target = '%s-%s' % (env['TARGET_PRODUCT'], | 801 | 'TARGET_BUILD_VARIANT' in os.environ): |
803 | env['TARGET_BUILD_VARIANT']) | 802 | target = '%s-%s' % (os.environ('TARGET_PRODUCT'), |
803 | os.environ('TARGET_BUILD_VARIANT')) | ||
804 | [success, manifest_str] = server.GetApprovedManifest(branch, target) | 804 | [success, manifest_str] = server.GetApprovedManifest(branch, target) |
805 | else: | 805 | else: |
806 | [success, manifest_str] = server.GetApprovedManifest(branch) | 806 | [success, manifest_str] = server.GetApprovedManifest(branch) |
@@ -1111,8 +1111,8 @@ def _VerifyTag(project): | |||
1111 | return False | 1111 | return False |
1112 | 1112 | ||
1113 | env = os.environ.copy() | 1113 | env = os.environ.copy() |
1114 | env['GIT_DIR'] = project.gitdir.encode() | 1114 | env['GIT_DIR'] = project.gitdir |
1115 | env['GNUPGHOME'] = gpg_dir.encode() | 1115 | env['GNUPGHOME'] = gpg_dir |
1116 | 1116 | ||
1117 | cmd = [GIT, 'tag', '-v', cur] | 1117 | cmd = [GIT, 'tag', '-v', cur] |
1118 | proc = subprocess.Popen(cmd, | 1118 | proc = subprocess.Popen(cmd, |