Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(195)

Unified Diff: gclient_scm.py

Issue 247493002: Eliminate all interactive terminal prompts from git. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: fix scm_unittest.py Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | scm.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gclient_scm.py
diff --git a/gclient_scm.py b/gclient_scm.py
index 89647ac0eb6f0c10cc6569d0804aba7605f0aa5f..3cc9012cc00681754c8996787402aaadff69fe03 100644
--- a/gclient_scm.py
+++ b/gclient_scm.py
@@ -960,7 +960,8 @@ class GitWrapper(SCMWrapper):
def _Capture(self, args, **kwargs):
kwargs.setdefault('cwd', self.checkout_path)
kwargs.setdefault('stderr', subprocess2.PIPE)
- return subprocess2.check_output(['git'] + args, **kwargs).strip()
+ env = scm.GIT.ApplyEnvVars(kwargs)
+ return subprocess2.check_output(['git'] + args, env=env, **kwargs).strip()
def _UpdateBranchHeads(self, options, fetch=False):
"""Adds, and optionally fetches, "branch-heads" refspecs if requested."""
@@ -981,22 +982,11 @@ class GitWrapper(SCMWrapper):
kwargs.setdefault('stdout', self.out_fh)
kwargs['filter_fn'] = self.filter
kwargs.setdefault('print_stdout', False)
- # Don't prompt for passwords; just fail quickly and noisily.
- # By default, git will use an interactive terminal prompt when a username/
- # password is needed. That shouldn't happen in the chromium workflow,
- # and if it does, then gclient may hide the prompt in the midst of a flood
- # of terminal spew. The only indication that something has gone wrong
- # will be when gclient hangs unresponsively. Instead, we disable the
- # password prompt and simply allow git to fail noisily. The error
- # message produced by git will be copied to gclient's output.
- env = kwargs.get('env') or kwargs.setdefault('env', os.environ.copy())
- env.setdefault('GIT_ASKPASS', 'true')
- env.setdefault('SSH_ASKPASS', 'true')
-
+ env = scm.GIT.ApplyEnvVars(kwargs)
cmd = ['git'] + args
header = "running '%s' in '%s'" % (' '.join(cmd), cwd)
self.filter(header)
- return gclient_utils.CheckCallAndFilter(cmd, **kwargs)
+ return gclient_utils.CheckCallAndFilter(cmd, env=env, **kwargs)
class SVNWrapper(SCMWrapper):
« no previous file with comments | « no previous file | scm.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698