Fix 236148: Avoid triggering a pager in internal git commands.

BUG=236148

Review URL: https://chromiumcodereview.appspot.com/14104005

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@197872 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/tests/git_cl_test.py b/tests/git_cl_test.py
index d661065..73d9595 100755
--- a/tests/git_cl_test.py
+++ b/tests/git_cl_test.py
@@ -117,73 +117,83 @@
   def _git_base_calls(cls, similarity, find_copies):
     if similarity is None:
       similarity = '50'
-      similarity_call = ((['git', 'config', '--int', '--get',
+      similarity_call = ((['git', '--no-pager', 'config', '--int', '--get',
                          'branch.master.git-cl-similarity'],), '')
     else:
-      similarity_call = ((['git', 'config', '--int',
+      similarity_call = ((['git', '--no-pager', 'config', '--int',
                          'branch.master.git-cl-similarity', similarity],), '')
 
     if find_copies is None:
       find_copies = True
-      find_copies_call = ((['git', 'config', '--int', '--get',
+      find_copies_call = ((['git', '--no-pager', 'config', '--int', '--get',
                           'branch.master.git-find-copies'],), '')
     else:
       val = str(int(find_copies))
-      find_copies_call = ((['git', 'config', '--int',
+      find_copies_call = ((['git', '--no-pager', 'config', '--int',
                           'branch.master.git-find-copies', val],), '')
 
     if find_copies:
-      stat_call = ((['git', 'diff', '--no-ext-diff', '--stat',
+      stat_call = ((['git', '--no-pager', 'diff', '--no-ext-diff', '--stat',
                    '--find-copies-harder', '-l100000', '-C'+similarity,
                    'fake_ancestor_sha', 'HEAD'],), '+dat')
     else:
-      stat_call = ((['git', 'diff', '--no-ext-diff', '--stat',
+      stat_call = ((['git', '--no-pager', 'diff', '--no-ext-diff', '--stat',
                    '-M'+similarity, 'fake_ancestor_sha', 'HEAD'],), '+dat')
 
     return [
-      ((['git', 'config', 'rietveld.server'],), 'codereview.example.com'),
-      ((['git', 'symbolic-ref', 'HEAD'],), 'master'),
+      ((['git', '--no-pager', 'config', 'rietveld.server'],),
+       'codereview.example.com'),
+      ((['git', '--no-pager', 'symbolic-ref', 'HEAD'],), 'master'),
       similarity_call,
-      ((['git', 'symbolic-ref', 'HEAD'],), 'master'),
+      ((['git', '--no-pager', 'symbolic-ref', 'HEAD'],), 'master'),
       find_copies_call,
-      ((['git', 'update-index', '--refresh', '-q'],), ''),
-      ((['git', 'diff-index', '--name-status', 'HEAD'],), ''),
-      ((['git', 'symbolic-ref', 'HEAD'],), 'master'),
-      ((['git', 'config', 'branch.master.merge'],), 'master'),
-      ((['git', 'config', 'branch.master.remote'],), 'origin'),
-      ((['git', 'merge-base', 'master', 'HEAD'],), 'fake_ancestor_sha'),
+      ((['git', '--no-pager', 'update-index', '--refresh', '-q'],), ''),
+      ((['git', '--no-pager', 'diff-index', '--name-status', 'HEAD'],), ''),
+      ((['git', '--no-pager', 'symbolic-ref', 'HEAD'],), 'master'),
+      ((['git', '--no-pager', 'config', 'branch.master.merge'],), 'master'),
+      ((['git', '--no-pager', 'config', 'branch.master.remote'],), 'origin'),
+      ((['git', '--no-pager', 'merge-base', 'master', 'HEAD'],),
+       'fake_ancestor_sha'),
       ] + cls._git_sanity_checks('fake_ancestor_sha', 'master') + [
-      ((['git', 'rev-parse', '--show-cdup'],), ''),
-      ((['git', 'rev-parse', 'HEAD'],), '12345'),
-      ((['git', 'diff', '--name-status', '-r', 'fake_ancestor_sha...', '.'],),
+      ((['git', '--no-pager', 'rev-parse', '--show-cdup'],), ''),
+      ((['git', '--no-pager', 'rev-parse', 'HEAD'],), '12345'),
+      ((['git', '--no-pager', 'diff', '--name-status', '-r',
+         'fake_ancestor_sha...', '.'],),
         'M\t.gitignore\n'),
-      ((['git', 'config', 'branch.master.rietveldissue'],), ''),
-      ((['git', 'config', 'branch.master.rietveldpatchset'],), ''),
-      ((['git', 'log', '--pretty=format:%s%n%n%b', 'fake_ancestor_sha...'],),
+      ((['git', '--no-pager', 'config', 'branch.master.rietveldissue'],), ''),
+      ((['git', '--no-pager', 'config', 'branch.master.rietveldpatchset'],),
+       ''),
+      ((['git', '--no-pager', 'log', '--pretty=format:%s%n%n%b',
+         'fake_ancestor_sha...'],),
        'foo'),
-      ((['git', 'config', 'user.email'],), 'me@example.com'),
+      ((['git', '--no-pager', 'config', 'user.email'],), 'me@example.com'),
       stat_call,
-      ((['git', 'config', 'gerrit.host'],), ''),
-      ((['git', 'log', '--pretty=format:%s\n\n%b', 'fake_ancestor_sha..HEAD'],),
+      ((['git', '--no-pager', 'config', 'gerrit.host'],), ''),
+      ((['git', '--no-pager', 'log', '--pretty=format:%s\n\n%b',
+         'fake_ancestor_sha..HEAD'],),
        'desc\n'),
     ]
 
   @classmethod
   def _git_upload_calls(cls):
     return [
-      ((['git', 'config', 'rietveld.cc'],), ''),
-      ((['git', 'config', 'branch.master.base-url'],), ''),
-      ((['git', 'config', '--local', '--get-regexp', '^svn-remote\\.'],),
+      ((['git', '--no-pager', 'config', 'rietveld.cc'],), ''),
+      ((['git', '--no-pager', 'config', 'branch.master.base-url'],), ''),
+      ((['git', '--no-pager',
+         'config', '--local', '--get-regexp', '^svn-remote\\.'],),
         (('', None), 0)),
-      ((['git', 'rev-parse', '--show-cdup'],), ''),
-      ((['git', 'svn', 'info'],), ''),
-      ((['git', 'config', 'branch.master.rietveldissue', '1'],), ''),
-      ((['git', 'config', 'branch.master.rietveldserver',
+      ((['git', '--no-pager', 'rev-parse', '--show-cdup'],), ''),
+      ((['git', '--no-pager', 'svn', 'info'],), ''),
+      ((['git', '--no-pager',
+         'config', 'branch.master.rietveldissue', '1'],), ''),
+      ((['git', '--no-pager', 'config', 'branch.master.rietveldserver',
           'https://codereview.example.com'],), ''),
-      ((['git', 'config', 'branch.master.rietveldpatchset', '2'],), ''),
-      ((['git', 'rev-parse', 'HEAD'],), 'hash'),
-      ((['git', 'symbolic-ref', 'HEAD'],), 'hash'),
-      ((['git', 'config', 'branch.hash.last-upload-hash', 'hash'],), ''),
+      ((['git', '--no-pager',
+         'config', 'branch.master.rietveldpatchset', '2'],), ''),
+      ((['git', '--no-pager', 'rev-parse', 'HEAD'],), 'hash'),
+      ((['git', '--no-pager', 'symbolic-ref', 'HEAD'],), 'hash'),
+      ((['git', '--no-pager',
+         'config', 'branch.hash.last-upload-hash', 'hash'],), ''),
     ]
 
   @staticmethod
@@ -192,75 +202,91 @@
     fake_cl = 'fake_cl_for_patch'
     return [
       # Calls to verify branch point is ancestor
-      ((['git', 'rev-parse', '--verify', diff_base],), fake_ancestor),
-      ((['git', 'merge-base', fake_ancestor, 'HEAD'],), fake_ancestor),
-      ((['git', 'rev-list', '^' + fake_ancestor, 'HEAD'],), fake_cl),
+      ((['git', '--no-pager',
+         'rev-parse', '--verify', diff_base],), fake_ancestor),
+      ((['git', '--no-pager',
+         'merge-base', fake_ancestor, 'HEAD'],), fake_ancestor),
+      ((['git', '--no-pager',
+         'rev-list', '^' + fake_ancestor, 'HEAD'],), fake_cl),
       # Mock a config miss (error code 1)
-      ((['git', 'config', 'gitcl.remotebranch'],), (('', None), 1)),
+      ((['git', '--no-pager',
+         'config', 'gitcl.remotebranch'],), (('', None), 1)),
       # Call to GetRemoteBranch()
-      ((['git', 'config', 'branch.%s.merge' % working_branch],),
+      ((['git', '--no-pager',
+         'config', 'branch.%s.merge' % working_branch],),
        'refs/heads/master'),
-      ((['git', 'config', 'branch.%s.remote' % working_branch],), 'origin'),
-      ((['git', 'rev-list', '^' + fake_ancestor,
+      ((['git', '--no-pager',
+         'config', 'branch.%s.remote' % working_branch],), 'origin'),
+      ((['git', '--no-pager', 'rev-list', '^' + fake_ancestor,
          'refs/remotes/origin/master'],), ''),
        ]
 
   @classmethod
   def _dcommit_calls_1(cls):
     return [
-      ((['git', 'config', '--local', '--get-regexp', '^svn-remote\\.'],),
+      ((['git', '--no-pager',
+         'config', '--local', '--get-regexp', '^svn-remote\\.'],),
        ((('svn-remote.svn.url svn://svn.chromium.org/chrome\n'
           'svn-remote.svn.fetch trunk/src:refs/remotes/origin/master'),
          None),
         0)),
-      ((['git', 'config', 'rietveld.server'],), 'codereview.example.com'),
-      ((['git', 'symbolic-ref', 'HEAD'],), 'refs/heads/working'),
-      ((['git', 'config', '--int', '--get',
+      ((['git', '--no-pager',
+         'config', 'rietveld.server'],), 'codereview.example.com'),
+      ((['git', '--no-pager', 'symbolic-ref', 'HEAD'],), 'refs/heads/working'),
+      ((['git', '--no-pager', 'config', '--int', '--get',
         'branch.working.git-cl-similarity'],), ''),
-      ((['git', 'symbolic-ref', 'HEAD'],), 'refs/heads/working'),
-      ((['git', 'config', '--int', '--get',
+      ((['git', '--no-pager', 'symbolic-ref', 'HEAD'],), 'refs/heads/working'),
+      ((['git', '--no-pager', 'config', '--int', '--get',
         'branch.working.git-find-copies'],), ''),
-      ((['git', 'symbolic-ref', 'HEAD'],), 'refs/heads/working'),
-      ((['git', 'config', 'branch.working.merge'],), 'refs/heads/master'),
-      ((['git', 'config', 'branch.working.remote'],), 'origin'),
-      ((['git', 'rev-list', '--merges',
+      ((['git', '--no-pager', 'symbolic-ref', 'HEAD'],), 'refs/heads/working'),
+      ((['git', '--no-pager',
+         'config', 'branch.working.merge'],), 'refs/heads/master'),
+      ((['git', '--no-pager', 'config', 'branch.working.remote'],), 'origin'),
+      ((['git', '--no-pager', 'rev-list', '--merges',
          '--grep=^SVN changes up to revision [0-9]*$',
          'refs/remotes/origin/master^!'],), ''),
-      ((['git', 'update-index', '--refresh', '-q'],), ''),
-      ((['git', 'diff-index', '--name-status', 'HEAD'],), ''),
-      ((['git', 'rev-list', '^refs/heads/working',
+      ((['git', '--no-pager', 'update-index', '--refresh', '-q'],), ''),
+      ((['git', '--no-pager', 'diff-index', '--name-status', 'HEAD'],), ''),
+      ((['git', '--no-pager', 'rev-list', '^refs/heads/working',
          'refs/remotes/origin/master'],),
          ''),
-      ((['git', 'log', '--grep=^git-svn-id:', '-1', '--pretty=format:%H'],),
+      ((['git', '--no-pager',
+         'log', '--grep=^git-svn-id:', '-1', '--pretty=format:%H'],),
          '3fc18b62c4966193eb435baabe2d18a3810ec82e'),
-      ((['git', 'rev-list', '^3fc18b62c4966193eb435baabe2d18a3810ec82e',
+      ((['git', '--no-pager',
+         'rev-list', '^3fc18b62c4966193eb435baabe2d18a3810ec82e',
          'refs/remotes/origin/master'],), ''),
-      ((['git', 'merge-base', 'refs/remotes/origin/master', 'HEAD'],),
+      ((['git', '--no-pager',
+         'merge-base', 'refs/remotes/origin/master', 'HEAD'],),
        'fake_ancestor_sha'),
     ]
 
   @classmethod
   def _dcommit_calls_normal(cls):
     return [
-      ((['git', 'rev-parse', '--show-cdup'],), ''),
-      ((['git', 'rev-parse', 'HEAD'],),
+      ((['git', '--no-pager', 'rev-parse', '--show-cdup'],), ''),
+      ((['git', '--no-pager', 'rev-parse', 'HEAD'],),
           '00ff397798ea57439712ed7e04ab96e13969ef40'),
-      ((['git', 'diff', '--name-status', '-r', 'fake_ancestor_sha...',
+      ((['git', '--no-pager',
+         'diff', '--name-status', '-r', 'fake_ancestor_sha...',
          '.'],),
         'M\tPRESUBMIT.py'),
-      ((['git', 'config', 'branch.working.rietveldissue'],), '12345'),
-      ((['git', 'config', 'branch.working.rietveldpatchset'],), '31137'),
-      ((['git', 'config', 'branch.working.rietveldserver'],),
+      ((['git', '--no-pager',
+         'config', 'branch.working.rietveldissue'],), '12345'),
+      ((['git', '--no-pager',
+         'config', 'branch.working.rietveldpatchset'],), '31137'),
+      ((['git', '--no-pager', 'config', 'branch.working.rietveldserver'],),
          'codereview.example.com'),
-      ((['git', 'config', 'user.email'],), 'author@example.com'),
-      ((['git', 'config', 'rietveld.tree-status-url'],), ''),
+      ((['git', '--no-pager', 'config', 'user.email'],), 'author@example.com'),
+      ((['git', '--no-pager', 'config', 'rietveld.tree-status-url'],), ''),
   ]
 
   @classmethod
   def _dcommit_calls_bypassed(cls):
     return [
-      ((['git', 'config', 'branch.working.rietveldissue'],), '12345'),
-      ((['git', 'config', 'branch.working.rietveldserver'],),
+      ((['git', '--no-pager',
+         'config', 'branch.working.rietveldissue'],), '12345'),
+      ((['git', '--no-pager', 'config', 'branch.working.rietveldserver'],),
          'codereview.example.com'),
       (('GitClHooksBypassedCommit',
         'Issue https://codereview.example.com/12345 bypassed hook when '
@@ -270,29 +296,31 @@
   @classmethod
   def _dcommit_calls_3(cls):
     return [
-      ((['git', 'diff', '--no-ext-diff', '--stat', '--find-copies-harder',
+      ((['git', '--no-pager',
+         'diff', '--no-ext-diff', '--stat', '--find-copies-harder',
          '-l100000', '-C50', 'fake_ancestor_sha',
          'refs/heads/working'],),
        (' PRESUBMIT.py |    2 +-\n'
         ' 1 files changed, 1 insertions(+), 1 deletions(-)\n')),
       (('About to commit; enter to confirm.',), None),
-      ((['git', 'show-ref', '--quiet', '--verify',
+      ((['git', '--no-pager', 'show-ref', '--quiet', '--verify',
          'refs/heads/git-cl-commit'],),
        (('', None), 0)),
-      ((['git', 'branch', '-D', 'git-cl-commit'],), ''),
-      ((['git', 'show-ref', '--quiet', '--verify',
+      ((['git', '--no-pager', 'branch', '-D', 'git-cl-commit'],), ''),
+      ((['git', '--no-pager', 'show-ref', '--quiet', '--verify',
          'refs/heads/git-cl-cherry-pick'],), ''),
-      ((['git', 'rev-parse', '--show-cdup'],), '\n'),
-      ((['git', 'checkout', '-q', '-b', 'git-cl-commit'],), ''),
-      ((['git', 'reset', '--soft', 'fake_ancestor_sha'],), ''),
-      ((['git', 'commit', '-m',
+      ((['git', '--no-pager', 'rev-parse', '--show-cdup'],), '\n'),
+      ((['git', '--no-pager', 'checkout', '-q', '-b', 'git-cl-commit'],), ''),
+      ((['git', '--no-pager', 'reset', '--soft', 'fake_ancestor_sha'],), ''),
+      ((['git', '--no-pager', 'commit', '-m',
          'Issue: 12345\n\nR=john@chromium.org\n\n'
          'Review URL: https://codereview.example.com/12345'],),
        ''),
-      ((['git', 'svn', 'dcommit', '-C50', '--no-rebase', '--rmdir'],),
+      ((['git', '--no-pager',
+         'svn', 'dcommit', '-C50', '--no-rebase', '--rmdir'],),
        (('', None), 0)),
-      ((['git', 'checkout', '-q', 'working'],), ''),
-      ((['git', 'branch', '-D', 'git-cl-commit'],), ''),
+      ((['git', '--no-pager', 'checkout', '-q', 'working'],), ''),
+      ((['git', '--no-pager', 'branch', '-D', 'git-cl-commit'],), ''),
   ]
 
   @staticmethod
@@ -452,30 +480,36 @@
   @classmethod
   def _gerrit_base_calls(cls):
     return [
-        ((['git', 'config', 'rietveld.server'],), 'codereview.example.com'),
-        ((['git', 'symbolic-ref', 'HEAD'],), 'master'),
-        ((['git', 'config', '--int', '--get',
+        ((['git', '--no-pager',
+           'config', 'rietveld.server'],), 'codereview.example.com'),
+        ((['git', '--no-pager', 'symbolic-ref', 'HEAD'],), 'master'),
+        ((['git', '--no-pager', 'config', '--int', '--get',
           'branch.master.git-cl-similarity'],), ''),
-        ((['git', 'symbolic-ref', 'HEAD'],), 'master'),
-        ((['git', 'config', '--int', '--get',
+        ((['git', '--no-pager', 'symbolic-ref', 'HEAD'],), 'master'),
+        ((['git', '--no-pager', 'config', '--int', '--get',
           'branch.master.git-find-copies'],), ''),
-        ((['git', 'update-index', '--refresh', '-q'],), ''),
-        ((['git', 'diff-index', '--name-status', 'HEAD'],), ''),
-        ((['git', 'symbolic-ref', 'HEAD'],), 'master'),
-        ((['git', 'config', 'branch.master.merge'],), 'master'),
-        ((['git', 'config', 'branch.master.remote'],), 'origin'),
-        ((['git', 'merge-base', 'master', 'HEAD'],), 'fake_ancestor_sha'),
+        ((['git', '--no-pager', 'update-index', '--refresh', '-q'],), ''),
+        ((['git', '--no-pager', 'diff-index', '--name-status', 'HEAD'],), ''),
+        ((['git', '--no-pager', 'symbolic-ref', 'HEAD'],), 'master'),
+        ((['git', '--no-pager', 'config', 'branch.master.merge'],), 'master'),
+        ((['git', '--no-pager', 'config', 'branch.master.remote'],), 'origin'),
+        ((['git', '--no-pager',
+           'merge-base', 'master', 'HEAD'],), 'fake_ancestor_sha'),
         ] + cls._git_sanity_checks('fake_ancestor_sha', 'master') + [
-        ((['git', 'rev-parse', '--show-cdup'],), ''),
-        ((['git', 'rev-parse', 'HEAD'],), '12345'),
-        ((['git', 'diff', '--name-status', '-r', 'fake_ancestor_sha...', '.'],),
+        ((['git', '--no-pager', 'rev-parse', '--show-cdup'],), ''),
+        ((['git', '--no-pager', 'rev-parse', 'HEAD'],), '12345'),
+        ((['git', '--no-pager',
+           'diff', '--name-status', '-r', 'fake_ancestor_sha...', '.'],),
          'M\t.gitignore\n'),
-        ((['git', 'config', 'branch.master.rietveldissue'],), ''),
-        ((['git', 'config', 'branch.master.rietveldpatchset'],), ''),
-        ((['git', 'log', '--pretty=format:%s%n%n%b', 'fake_ancestor_sha...'],),
+        ((['git', '--no-pager', 'config', 'branch.master.rietveldissue'],), ''),
+        ((['git', '--no-pager',
+           'config', 'branch.master.rietveldpatchset'],), ''),
+        ((['git', '--no-pager',
+           'log', '--pretty=format:%s%n%n%b', 'fake_ancestor_sha...'],),
          'foo'),
-        ((['git', 'config', 'user.email'],), 'me@example.com'),
-        ((['git', 'diff', '--no-ext-diff', '--stat', '--find-copies-harder',
+        ((['git', '--no-pager', 'config', 'user.email'],), 'me@example.com'),
+        ((['git', '--no-pager',
+           'diff', '--no-ext-diff', '--stat', '--find-copies-harder',
            '-l100000', '-C50', 'fake_ancestor_sha', 'HEAD'],),
          '+dat'),
         ]
@@ -483,24 +517,25 @@
   @staticmethod
   def _gerrit_upload_calls(description, reviewers):
     calls = [
-        ((['git', 'config', 'gerrit.host'],), 'gerrit.example.com'),
-        ((['git', 'log', '--pretty=format:%s\n\n%b',
+        ((['git', '--no-pager', 'config', 'gerrit.host'],),
+         'gerrit.example.com'),
+        ((['git', '--no-pager', 'log', '--pretty=format:%s\n\n%b',
            'fake_ancestor_sha..HEAD'],),
          description)
         ]
     if git_cl.CHANGE_ID not in description:
       calls += [
-          ((['git', 'log', '--pretty=format:%s\n\n%b',
+          ((['git', '--no-pager', 'log', '--pretty=format:%s\n\n%b',
              'fake_ancestor_sha..HEAD'],),
            description),
-          ((['git', 'commit', '--amend', '-m', description],),
+          ((['git', '--no-pager', 'commit', '--amend', '-m', description],),
            ''),
-          ((['git', 'log', '--pretty=format:%s\n\n%b',
+          ((['git', '--no-pager', 'log', '--pretty=format:%s\n\n%b',
              'fake_ancestor_sha..HEAD'],),
            description)
           ]
     calls += [
-        ((['git', 'config', 'rietveld.cc'],), '')
+        ((['git', '--no-pager', 'config', 'rietveld.cc'],), '')
         ]
     receive_pack = '--receive-pack=git receive-pack '
     receive_pack += '--cc=joe@example.com'  # from watch list
@@ -510,7 +545,8 @@
           '--reviewer=' + email for email in sorted(reviewers))
     receive_pack += ''
     calls += [
-        ((['git', 'push', receive_pack, 'origin', 'HEAD:refs/for/master'],),
+        ((['git', '--no-pager',
+           'push', receive_pack, 'origin', 'HEAD:refs/for/master'],),
          '')
         ]
     return calls
@@ -578,29 +614,36 @@
     self.mock(git_cl.os.path, 'exists', Exists)
     self.mock(git_cl, 'urlretrieve', self._mocked_call)
     self.calls = [
-        ((['git', 'config', 'rietveld.server', 'gerrit.chromium.org'],), ''),
-        ((['git', 'config', '--unset-all', 'rietveld.cc'],), ''),
-        ((['git', 'config', '--unset-all', 'rietveld.tree-status-url'],), ''),
-        ((['git', 'config', '--unset-all', 'rietveld.viewvc-url'],), ''),
-        ((['git', 'config', 'gerrit.host', 'gerrit.chromium.org'],), ''),
-        ((['git', 'config', 'gerrit.port', '29418'],), ''),
+        ((['git', '--no-pager', 'config', 'rietveld.server',
+           'gerrit.chromium.org'],), ''),
+        ((['git', '--no-pager', 'config', '--unset-all', 'rietveld.cc'],), ''),
+        ((['git', '--no-pager', 'config', '--unset-all',
+           'rietveld.tree-status-url'],), ''),
+        ((['git', '--no-pager', 'config', '--unset-all',
+           'rietveld.viewvc-url'],), ''),
+        ((['git', '--no-pager', 'config', 'gerrit.host',
+           'gerrit.chromium.org'],), ''),
+        ((['git', '--no-pager', 'config', 'gerrit.port', '29418'],), ''),
         # DownloadHooks(False)
-        ((['git', 'config', 'gerrit.host'],), 'gerrit.chromium.org'),
-        ((['git', 'config', 'rietveld.server'],), 'gerrit.chromium.org'),
-        ((['git', 'rev-parse', '--show-cdup'],), ''),
+        ((['git', '--no-pager', 'config', 'gerrit.host'],),
+         'gerrit.chromium.org'),
+        ((['git', '--no-pager', 'config', 'rietveld.server'],),
+         'gerrit.chromium.org'),
+        ((['git', '--no-pager', 'rev-parse', '--show-cdup'],), ''),
         ((commit_msg_path, os.X_OK,), False),
         (('https://gerrit.chromium.org/tools/hooks/commit-msg',
           commit_msg_path,), ''),
         ((commit_msg_path, stat.S_IRUSR | stat.S_IWUSR | stat.S_IXUSR,), ''),
         # GetCodereviewSettingsInteractively
-        ((['git', 'config', 'rietveld.server'],), 'gerrit.chromium.org'),
+        ((['git', '--no-pager', 'config', 'rietveld.server'],),
+         'gerrit.chromium.org'),
         (('Rietveld server (host[:port]) [https://gerrit.chromium.org]:',),
          ''),
-        ((['git', 'config', 'rietveld.cc'],), ''),
+        ((['git', '--no-pager', 'config', 'rietveld.cc'],), ''),
         (('CC list:',), ''),
-        ((['git', 'config', 'rietveld.tree-status-url'],), ''),
+        ((['git', '--no-pager', 'config', 'rietveld.tree-status-url'],), ''),
         (('Tree status URL:',), ''),
-        ((['git', 'config', 'rietveld.viewvc-url'],), ''),
+        ((['git', '--no-pager', 'config', 'rietveld.viewvc-url'],), ''),
         (('ViewVC URL:',), ''),
         # DownloadHooks(True)
         ((commit_msg_path, os.X_OK,), True),