summaryrefslogtreecommitdiffstats
path: root/subcmds
diff options
context:
space:
mode:
authorShawn O. Pearce <sop@google.com>2010-12-07 11:41:05 -0800
committerShawn O. Pearce <sop@google.com>2011-01-09 16:13:56 -0800
commitf18cb761731a791bf1b9ee8c6308bfce5c9d3e62 (patch)
tree5b1440e04b3945177eb7033f40cf496e7e28ba34 /subcmds
parentd3fd537ea59272e2141ccee839400a93c0196e36 (diff)
downloadgit-repo-f18cb761731a791bf1b9ee8c6308bfce5c9d3e62.tar.gz
Encode the environment variables passed to git
Windows allows the environment to have unicode values. This will cause Python to fail to execute the command. Change-Id: I37d922c3d7ced0d5b4883f0220346ac42defc5e9 Signed-off-by: Shawn O. Pearce <sop@google.com>
Diffstat (limited to 'subcmds')
-rw-r--r--subcmds/forall.py4
-rw-r--r--subcmds/sync.py8
2 files changed, 6 insertions, 6 deletions
diff --git a/subcmds/forall.py b/subcmds/forall.py
index b66313d7..8209c806 100644
--- a/subcmds/forall.py
+++ b/subcmds/forall.py
@@ -151,11 +151,11 @@ terminal and are not redirected.
151 first = True 151 first = True
152 152
153 for project in self.GetProjects(args): 153 for project in self.GetProjects(args):
154 env = dict(os.environ.iteritems()) 154 env = os.environ.copy()
155 def setenv(name, val): 155 def setenv(name, val):
156 if val is None: 156 if val is None:
157 val = '' 157 val = ''
158 env[name] = val 158 env[name] = val.encode()
159 159
160 setenv('REPO_PROJECT', project.name) 160 setenv('REPO_PROJECT', project.name)
161 setenv('REPO_PATH', project.relpath) 161 setenv('REPO_PATH', project.relpath)
diff --git a/subcmds/sync.py b/subcmds/sync.py
index d6ea442a..80bba1aa 100644
--- a/subcmds/sync.py
+++ b/subcmds/sync.py
@@ -269,7 +269,7 @@ uncommitted changes are present' % project.relpath
269 if branch.startswith(R_HEADS): 269 if branch.startswith(R_HEADS):
270 branch = branch[len(R_HEADS):] 270 branch = branch[len(R_HEADS):]
271 271
272 env = dict(os.environ) 272 env = os.environ.copy()
273 if (env.has_key('TARGET_PRODUCT') and 273 if (env.has_key('TARGET_PRODUCT') and
274 env.has_key('TARGET_BUILD_VARIANT')): 274 env.has_key('TARGET_BUILD_VARIANT')):
275 target = '%s-%s' % (env['TARGET_PRODUCT'], 275 target = '%s-%s' % (env['TARGET_PRODUCT'],
@@ -413,9 +413,9 @@ warning: Cannot automatically authenticate repo."""
413 % (project.name, rev) 413 % (project.name, rev)
414 return False 414 return False
415 415
416 env = dict(os.environ) 416 env = os.environ.copy()
417 env['GIT_DIR'] = project.gitdir 417 env['GIT_DIR'] = project.gitdir.encode()
418 env['GNUPGHOME'] = gpg_dir 418 env['GNUPGHOME'] = gpg_dir.encode()
419 419
420 cmd = [GIT, 'tag', '-v', cur] 420 cmd = [GIT, 'tag', '-v', cur]
421 proc = subprocess.Popen(cmd, 421 proc = subprocess.Popen(cmd,