(command.CommandList
  children: [
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:test_description)
          op: assign_op.Equal
          rhs: {(SQ <'Test automatic use of a pager.'>)}
          spids: [4]
        )
      ]
    )
    (C {<.>} {<'./test-lib.sh'>})
    (C {<.>} {(DQ ($ Id.VSub_DollarName '$TEST_DIRECTORY')) <'/lib-pager.sh'>})
    (C {<.>} {(DQ ($ Id.VSub_DollarName '$TEST_DIRECTORY')) <'/lib-terminal.sh'>})
    (C {<test_expect_success>} {(SQ <setup>)} 
      {
        (SQ <'\n'> <'\tsane_unset GIT_PAGER GIT_PAGER_IN_USE &&\n'> <'\ttest_unconfig core.pager &&\n'> 
          <'\n'> <'\tPAGER="cat >paginated.out" &&\n'> <'\texport PAGER &&\n'> <'\n'> <'\ttest_commit initial\n'>
        )
      }
    )
    (C {<test_expect_success>} {<TTY>} {(SQ <'some commands use a pager'>)} 
      {
        (SQ <'\n'> <'\trm -f paginated.out &&\n'> <'\ttest_terminal git log &&\n'> 
          <'\ttest -e paginated.out\n'>
        )
      }
    )
    (C {<test_expect_failure>} {<TTY>} {(SQ <'pager runs from subdir'>)} 
      {
        (SQ <'\n'> <'\techo subdir/paginated.out >expected &&\n'> <'\tmkdir -p subdir &&\n'> 
          <'\trm -f paginated.out subdir/paginated.out &&\n'> <'\t(\n'> <'\t\tcd subdir &&\n'> <'\t\ttest_terminal git log\n'> <'\t) &&\n'> <'\t{\n'> 
          <'\t\tls paginated.out subdir/paginated.out ||\n'> <'\t\t:\n'> <'\t} >actual &&\n'> <'\ttest_cmp expected actual\n'>
        )
      }
    )
    (C {<test_expect_success>} {<TTY>} {(SQ <'LESS and LV envvars are set for pagination'>)} 
      {
        (SQ <'\n'> <'\t(\n'> <'\t\tsane_unset LESS LV &&\n'> <'\t\tPAGER="env >pager-env.out; wc" &&\n'> 
          <'\t\texport PAGER &&\n'> <'\n'> <'\t\ttest_terminal git log\n'> <'\t) &&\n'> <'\tgrep ^LESS= pager-env.out &&\n'> 
          <'\tgrep ^LV= pager-env.out\n'>
        )
      }
    )
    (C {<test_expect_success>} {<Id.KW_Bang '!'> <MINGW> <Id.Lit_Comma ','> <TTY>} 
      {(SQ <'LESS and LV envvars set by git-sh-setup'>)} 
      {
        (SQ <'\n'> <'\t(\n'> <'\t\tsane_unset LESS LV &&\n'> <'\t\tPAGER="env >pager-env.out; wc" &&\n'> 
          <'\t\texport PAGER &&\n'> <'\t\tPATH="$(git --exec-path):$PATH" &&\n'> <'\t\texport PATH &&\n'> 
          <'\t\ttest_terminal sh -c ". git-sh-setup && git_pager"\n'> <'\t) &&\n'> <'\tgrep ^LESS= pager-env.out &&\n'> <'\tgrep ^LV= pager-env.out\n'>
        )
      }
    )
    (C {<test_expect_success>} {<TTY>} {(SQ <'some commands do not use a pager'>)} 
      {
        (SQ <'\n'> <'\trm -f paginated.out &&\n'> <'\ttest_terminal git rev-list HEAD &&\n'> 
          <'\t! test -e paginated.out\n'>
        )
      }
    )
    (C {<test_expect_success>} {(SQ <'no pager when stdout is a pipe'>)} 
      {
        (SQ <'\n'> <'\trm -f paginated.out &&\n'> <'\tgit log | cat &&\n'> 
          <'\t! test -e paginated.out\n'>
        )
      }
    )
    (C {<test_expect_success>} {(SQ <'no pager when stdout is a regular file'>)} 
      {
        (SQ <'\n'> <'\trm -f paginated.out &&\n'> <'\tgit log >file &&\n'> 
          <'\t! test -e paginated.out\n'>
        )
      }
    )
    (C {<test_expect_success>} {<TTY>} {(SQ <'git --paginate rev-list uses a pager'>)} 
      {
        (SQ <'\n'> <'\trm -f paginated.out &&\n'> <'\ttest_terminal git --paginate rev-list HEAD &&\n'> 
          <'\ttest -e paginated.out\n'>
        )
      }
    )
    (C {<test_expect_success>} {(SQ <'no pager even with --paginate when stdout is a pipe'>)} 
      {
        (SQ <'\n'> <'\trm -f file paginated.out &&\n'> <'\tgit --paginate log | cat &&\n'> 
          <'\t! test -e paginated.out\n'>
        )
      }
    )
    (C {<test_expect_success>} {<TTY>} {(SQ <'no pager with --no-pager'>)} 
      {
        (SQ <'\n'> <'\trm -f paginated.out &&\n'> <'\ttest_terminal git --no-pager log &&\n'> 
          <'\t! test -e paginated.out\n'>
        )
      }
    )
    (C {<test_expect_success>} {<TTY>} {(SQ <'configuration can disable pager'>)} 
      {
        (SQ <'\n'> <'\trm -f paginated.out &&\n'> <'\ttest_unconfig pager.grep &&\n'> 
          <'\ttest_terminal git grep initial &&\n'> <'\ttest -e paginated.out &&\n'> <'\n'> <'\trm -f paginated.out &&\n'> 
          <'\ttest_config pager.grep false &&\n'> <'\ttest_terminal git grep initial &&\n'> <'\t! test -e paginated.out\n'>
        )
      }
    )
    (C {<test_expect_success>} {<TTY>} {(SQ <'git config uses a pager if configured to'>)} 
      {
        (SQ <'\n'> <'\trm -f paginated.out &&\n'> <'\ttest_config pager.config true &&\n'> 
          <'\ttest_terminal git config --list &&\n'> <'\ttest -e paginated.out\n'>
        )
      }
    )
    (C {<test_expect_success>} {<TTY>} {(SQ <'configuration can enable pager (from subdir)'>)} 
      {
        (SQ <'\n'> <'\trm -f paginated.out &&\n'> <'\tmkdir -p subdir &&\n'> 
          <'\ttest_config pager.bundle true &&\n'> <'\n'> <'\tgit bundle create test.bundle --all &&\n'> 
          <'\trm -f paginated.out subdir/paginated.out &&\n'> <'\t(\n'> <'\t\tcd subdir &&\n'> <'\t\ttest_terminal git bundle unbundle ../test.bundle\n'> <'\t) &&\n'> 
          <'\t{\n'> <'\t\ttest -e paginated.out ||\n'> <'\t\ttest -e subdir/paginated.out\n'> <'\t}\n'>
        )
      }
    )
    (command.ShFunction
      name: colorful
      body: 
        (BraceGroup
          children: [
            (command.Simple
              words: [{<read>} {<firstline>}]
              redirects: [
                (redir
                  op: <Id.Redir_Less '<'>
                  loc: (redir_loc.Fd fd:0)
                  arg: {($ Id.VSub_Number '$1')}
                )
              ]
              do_fork: T
            )
            (command.Pipeline
              children: [
                (command.Simple
                  words: [
                    {<expr>}
                    {(DQ ($ Id.VSub_DollarName '$firstline'))}
                    {<Id.Lit_Colon ':'>}
                    {(DQ <'[a-zA-Z]'>)}
                  ]
                  redirects: [
                    (redir
                      op: <Id.Redir_Great '>'>
                      loc: (redir_loc.Fd fd:1)
                      arg: {<'/dev/null'>}
                    )
                  ]
                  do_fork: T
                )
              ]
              negated: T
            )
          ]
        )
    )
    (C {<test_expect_success>} {(SQ <'tests can detect color'>)} 
      {
        (SQ <'\n'> <'\trm -f colorful.log colorless.log &&\n'> 
          <'\tgit log --no-color >colorless.log &&\n'> <'\tgit log --color >colorful.log &&\n'> <'\t! colorful colorless.log &&\n'> 
          <'\tcolorful colorful.log\n'>
        )
      }
    )
    (C {<test_expect_success>} {(SQ <'no color when stdout is a regular file'>)} 
      {
        (SQ <'\n'> <'\trm -f colorless.log &&\n'> <'\ttest_config color.ui auto &&\n'> 
          <'\tgit log >colorless.log &&\n'> <'\t! colorful colorless.log\n'>
        )
      }
    )
    (C {<test_expect_success>} {<TTY>} {(SQ <'color when writing to a pager'>)} 
      {
        (SQ <'\n'> <'\trm -f paginated.out &&\n'> <'\ttest_config color.ui auto &&\n'> 
          <'\ttest_terminal env TERM=vt100 git log &&\n'> <'\tcolorful paginated.out\n'>
        )
      }
    )
    (C {<test_expect_success>} {<TTY>} {(SQ <'colors are suppressed by color.pager'>)} 
      {
        (SQ <'\n'> <'\trm -f paginated.out &&\n'> <'\ttest_config color.ui auto &&\n'> 
          <'\ttest_config color.pager false &&\n'> <'\ttest_terminal env TERM=vt100 git log &&\n'> <'\t! colorful paginated.out\n'>
        )
      }
    )
    (C {<test_expect_success>} {(SQ <'color when writing to a file intended for a pager'>)} 
      {
        (SQ <'\n'> <'\trm -f colorful.log &&\n'> <'\ttest_config color.ui auto &&\n'> <'\t(\n'> 
          <'\t\tTERM=vt100 &&\n'> <'\t\tGIT_PAGER_IN_USE=true &&\n'> <'\t\texport TERM GIT_PAGER_IN_USE &&\n'> 
          <'\t\tgit log >colorful.log\n'> <'\t) &&\n'> <'\tcolorful colorful.log\n'>
        )
      }
    )
    (C {<test_expect_success>} {<TTY>} {(SQ <'colors are sent to pager for external commands'>)} 
      {
        (SQ <'\n'> <'\ttest_config alias.externallog "!git log" &&\n'> 
          <'\ttest_config color.ui auto &&\n'> <'\ttest_terminal env TERM=vt100 git -p externallog &&\n'> <'\tcolorful paginated.out\n'>
        )
      }
    )
    (command.ShFunction
      name: parse_args
      body: 
        (BraceGroup
          children: [
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:test_expectation)
                  op: assign_op.Equal
                  rhs: {(DQ <test_> ($ Id.VSub_Number '$1'))}
                  spids: [497]
                )
              ]
            )
            (C {<shift>})
            (command.If
              arms: [
                (if_arm
                  cond: [
                    (C {<test>} {(DQ ($ Id.VSub_Number '$1'))} {<Id.Lit_Equals '='>} {<test_must_fail>})
                  ]
                  action: [
                    (command.ShAssignment
                      pairs: [
                        (assign_pair
                          lhs: (sh_lhs_expr.Name name:full_command)
                          op: assign_op.Equal
                          rhs: {(DQ <'test_must_fail test_terminal '>)}
                          spids: [523]
                        )
                      ]
                    )
                    (C {<shift>})
                  ]
                  spids: [507 520]
                )
              ]
              else_action: [
                (command.ShAssignment
                  pairs: [
                    (assign_pair
                      lhs: (sh_lhs_expr.Name name:full_command)
                      op: assign_op.Equal
                      rhs: {(DQ <'test_terminal '>)}
                      spids: [535]
                    )
                  ]
                )
              ]
            )
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:cmd)
                  op: assign_op.Equal
                  rhs: {($ Id.VSub_Number '$1')}
                  spids: [544]
                )
              ]
            )
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:full_command)
                  op: assign_op.Equal
                  rhs: {(DQ ($ Id.VSub_DollarName '$full_command') <' '> ($ Id.VSub_Number '$1'))}
                  spids: [548]
                )
              ]
            )
          ]
        )
    )
    (command.ShFunction
      name: test_default_pager
      body: 
        (BraceGroup
          children: [
            (C {<parse_args>} {(DQ ($ Id.VSub_At '$@'))})
            (C {($ Id.VSub_DollarName '$test_expectation')} {<SIMPLEPAGER> <Id.Lit_Comma ','> <TTY>} 
              {(DQ ($ Id.VSub_DollarName '$cmd') <' - default pager is used by default'>)} 
              {
                (DQ <'\n'> <'\t\tsane_unset PAGER GIT_PAGER &&\n'> 
                  <'\t\ttest_unconfig core.pager &&\n'> <'\t\trm -f default_pager_used &&\n'> <'\t\tcat >'> 
                  (word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\$'>) <'less <<-'> <Id.Lit_Other '\\'> <'EOF &&\n'> <'\t\t#!/bin/sh\n'> <'\t\twc >default_pager_used\n'> 
                  <'\t\tEOF\n'> <'\t\tchmod +x '> (word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\$'>) <'less &&\n'> <'\t\t(\n'> 
                  <'\t\t\tPATH=.:'> (word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\$'>) <'PATH &&\n'> <'\t\t\texport PATH &&\n'> 
                  <'\t\t\t'> ($ Id.VSub_DollarName '$full_command') <'\n'> <'\t\t) &&\n'> <'\t\ttest -e default_pager_used\n'> <'\t'>
                )
              }
            )
          ]
        )
    )
    (command.ShFunction
      name: test_PAGER_overrides
      body: 
        (BraceGroup
          children: [
            (C {<parse_args>} {(DQ ($ Id.VSub_At '$@'))})
            (C {($ Id.VSub_DollarName '$test_expectation')} {<TTY>} 
              {(DQ ($ Id.VSub_DollarName '$cmd') <' - PAGER overrides default pager'>)} 
              {
                (DQ <'\n'> <'\t\tsane_unset GIT_PAGER &&\n'> <'\t\ttest_unconfig core.pager &&\n'> 
                  <'\t\trm -f PAGER_used &&\n'> <'\t\tPAGER=\'wc >PAGER_used\' &&\n'> <'\t\texport PAGER &&\n'> <'\t\t'> 
                  ($ Id.VSub_DollarName '$full_command') <' &&\n'> <'\t\ttest -e PAGER_used\n'> <'\t'>
                )
              }
            )
          ]
        )
    )
    (command.ShFunction
      name: test_core_pager_overrides
      body: 
        (BraceGroup
          children: [
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:if_local_config)
                  op: assign_op.Equal
                  rhs: (word.Empty)
                  spids: [664]
                )
              ]
            )
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:used_if_wanted)
                  op: assign_op.Equal
                  rhs: {(SQ <'overrides PAGER'>)}
                  spids: [667]
                )
              ]
            )
            (C {<test_core_pager>} {(DQ ($ Id.VSub_At '$@'))})
          ]
        )
    )
    (command.ShFunction
      name: test_local_config_ignored
      body: 
        (BraceGroup
          children: [
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:if_local_config)
                  op: assign_op.Equal
                  rhs: {(SQ <'! '>)}
                  spids: [689]
                )
              ]
            )
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:used_if_wanted)
                  op: assign_op.Equal
                  rhs: {(SQ <'is not used'>)}
                  spids: [695]
                )
              ]
            )
            (C {<test_core_pager>} {(DQ ($ Id.VSub_At '$@'))})
          ]
        )
    )
    (command.ShFunction
      name: test_core_pager
      body: 
        (BraceGroup
          children: [
            (C {<parse_args>} {(DQ ($ Id.VSub_At '$@'))})
            (C {($ Id.VSub_DollarName '$test_expectation')} {<TTY>} 
              {
                (DQ ($ Id.VSub_DollarName '$cmd') <' - repository-local core.pager setting '> 
                  ($ Id.VSub_DollarName '$used_if_wanted')
                )
              } 
              {
                (DQ <'\n'> <'\t\tsane_unset GIT_PAGER &&\n'> <'\t\trm -f core.pager_used &&\n'> 
                  <'\t\tPAGER=wc &&\n'> <'\t\texport PAGER &&\n'> <'\t\ttest_config core.pager \'wc >core.pager_used\' &&\n'> <'\t\t'> 
                  ($ Id.VSub_DollarName '$full_command') <' &&\n'> <'\t\t'> (${ Id.VSub_Name if_local_config) <'test -e core.pager_used\n'> <'\t'>
                )
              }
            )
          ]
        )
    )
    (command.ShFunction
      name: test_core_pager_subdir
      body: 
        (BraceGroup
          children: [
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:if_local_config)
                  op: assign_op.Equal
                  rhs: (word.Empty)
                  spids: [763]
                )
              ]
            )
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:used_if_wanted)
                  op: assign_op.Equal
                  rhs: {(SQ <'overrides PAGER'>)}
                  spids: [766]
                )
              ]
            )
            (C {<test_pager_subdir_helper>} {(DQ ($ Id.VSub_At '$@'))})
          ]
        )
    )
    (command.ShFunction
      name: test_no_local_config_subdir
      body: 
        (BraceGroup
          children: [
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:if_local_config)
                  op: assign_op.Equal
                  rhs: {(SQ <'! '>)}
                  spids: [788]
                )
              ]
            )
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:used_if_wanted)
                  op: assign_op.Equal
                  rhs: {(SQ <'is not used'>)}
                  spids: [794]
                )
              ]
            )
            (C {<test_pager_subdir_helper>} {(DQ ($ Id.VSub_At '$@'))})
          ]
        )
    )
    (command.ShFunction
      name: test_pager_subdir_helper
      body: 
        (BraceGroup
          children: [
            (C {<parse_args>} {(DQ ($ Id.VSub_At '$@'))})
            (C {($ Id.VSub_DollarName '$test_expectation')} {<TTY>} 
              {
                (DQ ($ Id.VSub_DollarName '$cmd') <' - core.pager '> 
                  ($ Id.VSub_DollarName '$used_if_wanted') <' from subdirectory'>
                )
              } 
              {
                (DQ <'\n'> <'\t\tsane_unset GIT_PAGER &&\n'> <'\t\trm -f core.pager_used &&\n'> 
                  <'\t\trm -fr sub &&\n'> <'\t\tPAGER=wc &&\n'> <'\t\tstampname='> (word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\$'>) 
                  <'(pwd)/core.pager_used &&\n'> <'\t\texport PAGER stampname &&\n'> <'\t\ttest_config core.pager \'wc >'> 
                  (word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\"'>) (word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\$'>) <stampname> 
                  (word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\"'>) <'\' &&\n'> <'\t\tmkdir sub &&\n'> <'\t\t(\n'> <'\t\t\tcd sub &&\n'> <'\t\t\t'> 
                  ($ Id.VSub_DollarName '$full_command') <'\n'> <'\t\t) &&\n'> <'\t\t'> (${ Id.VSub_Name if_local_config) <'test -e core.pager_used\n'> <'\t'>
                )
              }
            )
          ]
        )
    )
    (command.ShFunction
      name: test_GIT_PAGER_overrides
      body: 
        (BraceGroup
          children: [
            (C {<parse_args>} {(DQ ($ Id.VSub_At '$@'))})
            (C {($ Id.VSub_DollarName '$test_expectation')} {<TTY>} 
              {(DQ ($ Id.VSub_DollarName '$cmd') <' - GIT_PAGER overrides core.pager'>)} 
              {
                (DQ <'\n'> <'\t\trm -f GIT_PAGER_used &&\n'> <'\t\ttest_config core.pager wc &&\n'> 
                  <'\t\tGIT_PAGER=\'wc >GIT_PAGER_used\' &&\n'> <'\t\texport GIT_PAGER &&\n'> <'\t\t'> ($ Id.VSub_DollarName '$full_command') <' &&\n'> 
                  <'\t\ttest -e GIT_PAGER_used\n'> <'\t'>
                )
              }
            )
          ]
        )
    )
    (command.ShFunction
      name: test_doesnt_paginate
      body: 
        (BraceGroup
          children: [
            (C {<parse_args>} {(DQ ($ Id.VSub_At '$@'))})
            (C {($ Id.VSub_DollarName '$test_expectation')} {<TTY>} 
              {(DQ <'no pager for \''> ($ Id.VSub_DollarName '$cmd') <'\''>)} 
              {
                (DQ <'\n'> <'\t\trm -f GIT_PAGER_used &&\n'> 
                  <'\t\tGIT_PAGER=\'wc >GIT_PAGER_used\' &&\n'> <'\t\texport GIT_PAGER &&\n'> <'\t\t'> ($ Id.VSub_DollarName '$full_command') <' &&\n'> 
                  <'\t\t! test -e GIT_PAGER_used\n'> <'\t'>
                )
              }
            )
          ]
        )
    )
    (command.ShFunction
      name: test_pager_choices
      body: 
        (BraceGroup
          children: [
            (C {<test_default_pager>} {<expect_success>} {(DQ ($ Id.VSub_At '$@'))})
            (C {<test_PAGER_overrides>} {<expect_success>} {(DQ ($ Id.VSub_At '$@'))})
            (C {<test_core_pager_overrides>} {<expect_success>} {(DQ ($ Id.VSub_At '$@'))})
            (C {<test_core_pager_subdir>} {<expect_success>} {(DQ ($ Id.VSub_At '$@'))})
            (C {<test_GIT_PAGER_overrides>} {<expect_success>} {(DQ ($ Id.VSub_At '$@'))})
          ]
        )
    )
    (C {<test_expect_success>} {(SQ <'setup: some aliases'>)} 
      {(SQ <'\n'> <'\tgit config alias.aliasedlog log &&\n'> <'\tgit config alias.true "!true"\n'>)}
    )
    (C {<test_pager_choices>} {(SQ <'git log'>)})
    (C {<test_pager_choices>} {(SQ <'git -p log'>)})
    (C {<test_pager_choices>} {(SQ <'git aliasedlog'>)})
    (C {<test_default_pager>} {<expect_success>} {(SQ <'git -p aliasedlog'>)})
    (C {<test_PAGER_overrides>} {<expect_success>} {(SQ <'git -p aliasedlog'>)})
    (C {<test_core_pager_overrides>} {<expect_success>} {(SQ <'git -p aliasedlog'>)})
    (C {<test_core_pager_subdir>} {<expect_failure>} {(SQ <'git -p aliasedlog'>)})
    (C {<test_GIT_PAGER_overrides>} {<expect_success>} {(SQ <'git -p aliasedlog'>)})
    (C {<test_default_pager>} {<expect_success>} {(SQ <'git -p true'>)})
    (C {<test_PAGER_overrides>} {<expect_success>} {(SQ <'git -p true'>)})
    (C {<test_core_pager_overrides>} {<expect_success>} {(SQ <'git -p true'>)})
    (C {<test_core_pager_subdir>} {<expect_failure>} {(SQ <'git -p true'>)})
    (C {<test_GIT_PAGER_overrides>} {<expect_success>} {(SQ <'git -p true'>)})
    (C {<test_default_pager>} {<expect_success>} {<test_must_fail>} {(SQ <'git -p request-pull'>)})
    (C {<test_PAGER_overrides>} {<expect_success>} {<test_must_fail>} {(SQ <'git -p request-pull'>)})
    (C {<test_core_pager_overrides>} {<expect_success>} {<test_must_fail>} {(SQ <'git -p request-pull'>)})
    (C {<test_core_pager_subdir>} {<expect_failure>} {<test_must_fail>} {(SQ <'git -p request-pull'>)})
    (C {<test_GIT_PAGER_overrides>} {<expect_success>} {<test_must_fail>} {(SQ <'git -p request-pull'>)})
    (C {<test_default_pager>} {<expect_success>} {<test_must_fail>} {(SQ <'git -p'>)})
    (C {<test_PAGER_overrides>} {<expect_success>} {<test_must_fail>} {(SQ <'git -p'>)})
    (C {<test_local_config_ignored>} {<expect_failure>} {<test_must_fail>} {(SQ <'git -p'>)})
    (C {<test_no_local_config_subdir>} {<expect_success>} {<test_must_fail>} {(SQ <'git -p'>)})
    (C {<test_GIT_PAGER_overrides>} {<expect_success>} {<test_must_fail>} {(SQ <'git -p'>)})
    (C {<test_doesnt_paginate>} {<expect_failure>} {<test_must_fail>} {(SQ <'git -p nonsense'>)})
    (C {<test_pager_choices>} {(SQ <'git shortlog'>)})
    (C {<test_expect_success>} {(SQ <'setup: configure shortlog not to paginate'>)} 
      {(SQ <'\n'> <'\tgit config pager.shortlog false\n'>)}
    )
    (C {<test_doesnt_paginate>} {<expect_success>} {(SQ <'git shortlog'>)})
    (C {<test_no_local_config_subdir>} {<expect_success>} {(SQ <'git shortlog'>)})
    (C {<test_default_pager>} {<expect_success>} {(SQ <'git -p shortlog'>)})
    (C {<test_core_pager_subdir>} {<expect_success>} {(SQ <'git -p shortlog'>)})
    (C {<test_core_pager_subdir>} {<expect_success>} {<test_must_fail>} {(SQ <'git -p apply </dev/null'>)})
    (C {<test_expect_success>} {<TTY>} {(SQ <'command-specific pager'>)} 
      {
        (SQ <'\n'> <'\tsane_unset PAGER GIT_PAGER &&\n'> <'\techo "foo:initial" >expect &&\n'> 
          <'\t>actual &&\n'> <'\ttest_unconfig core.pager &&\n'> <'\ttest_config pager.log "sed s/^/foo:/ >actual" &&\n'> 
          <'\ttest_terminal git log --format=%s -1 &&\n'> <'\ttest_cmp expect actual\n'>
        )
      }
    )
    (C {<test_expect_success>} {<TTY>} {(SQ <'command-specific pager overrides core.pager'>)} 
      {
        (SQ <'\n'> <'\tsane_unset PAGER GIT_PAGER &&\n'> <'\techo "foo:initial" >expect &&\n'> 
          <'\t>actual &&\n'> <'\ttest_config core.pager "exit 1" &&\n'> <'\ttest_config pager.log "sed s/^/foo:/ >actual" &&\n'> 
          <'\ttest_terminal git log --format=%s -1 &&\n'> <'\ttest_cmp expect actual\n'>
        )
      }
    )
    (C {<test_expect_success>} {<TTY>} {(SQ <'command-specific pager overridden by environment'>)} 
      {
        (SQ <'\n'> <'\tGIT_PAGER="sed s/^/foo:/ >actual" && export GIT_PAGER &&\n'> <'\t>actual &&\n'> 
          <'\techo "foo:initial" >expect &&\n'> <'\ttest_config pager.log "exit 1" &&\n'> <'\ttest_terminal git log --format=%s -1 &&\n'> 
          <'\ttest_cmp expect actual\n'>
        )
      }
    )
    (C {<test_expect_success>} {(SQ <'setup external command'>)} 
      {
        (SQ <'\n'> <'\tcat >git-external <<-\\EOF &&\n'> <'\t#!/bin/sh\n'> <'\tgit "$@"\n'> <'\tEOF\n'> 
          <'\tchmod +x git-external\n'>
        )
      }
    )
    (C {<test_expect_success>} {<TTY>} {(SQ <'command-specific pager works for external commands'>)} 
      {
        (SQ <'\n'> <'\tsane_unset PAGER GIT_PAGER &&\n'> <'\techo "foo:initial" >expect &&\n'> 
          <'\t>actual &&\n'> <'\ttest_config pager.external "sed s/^/foo:/ >actual" &&\n'> 
          <'\ttest_terminal git --exec-path="$(pwd)" external log --format=%s -1 &&\n'> <'\ttest_cmp expect actual\n'>
        )
      }
    )
    (C {<test_expect_success>} {<TTY>} {(SQ <'sub-commands of externals use their own pager'>)} 
      {
        (SQ <'\n'> <'\tsane_unset PAGER GIT_PAGER &&\n'> <'\techo "foo:initial" >expect &&\n'> 
          <'\t>actual &&\n'> <'\ttest_config pager.log "sed s/^/foo:/ >actual" &&\n'> 
          <'\ttest_terminal git --exec-path=. external log --format=%s -1 &&\n'> <'\ttest_cmp expect actual\n'>
        )
      }
    )
    (C {<test_expect_success>} {<TTY>} {(SQ <'external command pagers override sub-commands'>)} 
      {
        (SQ <'\n'> <'\tsane_unset PAGER GIT_PAGER &&\n'> <'\t>expect &&\n'> <'\t>actual &&\n'> 
          <'\ttest_config pager.external false &&\n'> <'\ttest_config pager.log "sed s/^/log:/ >actual" &&\n'> 
          <'\ttest_terminal git --exec-path=. external log --format=%s -1 &&\n'> <'\ttest_cmp expect actual\n'>
        )
      }
    )
    (C {<test_expect_success>} {(SQ <'command with underscores does not complain'>)} 
      {
        (SQ <'\n'> <'\twrite_script git-under_score <<-\\EOF &&\n'> <'\techo ok\n'> <'\tEOF\n'> 
          <'\tgit --exec-path=. under_score >actual 2>&1 &&\n'> <'\techo ok >expect &&\n'> <'\ttest_cmp expect actual\n'>
        )
      }
    )
    (C {<test_done>})
  ]
)