(CommandList
  children: [
    (Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (LhsName name:test_description)
          op: Equal
          rhs: {(SQ <"Test automatic use of a pager.">)}
          spids: [4]
        )
      ]
      spids: [4]
    )
    (C {(.)} {(./test-lib.sh)})
    (C {(.)} {(DQ ($ VSub_Name "$TEST_DIRECTORY")) (/lib-pager.sh)})
    (C {(.)} {(DQ ($ VSub_Name "$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)} {(KW_Bang "!") (MINGW) (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">
        )
      }
    )
    (FuncDef
      name: colorful
      body: 
        (BraceGroup
          children: [
            (SimpleCommand
              words: [{(read)} {(firstline)}]
              redirects: [(Redir op_id:Redir_Less fd:-1 arg_word:{($ VSub_Number "$1")} spids:[309])]
            )
            (Pipeline
              children: [
                (SimpleCommand
                  words: [{(expr)} {(DQ ($ VSub_Name "$firstline"))} {(Lit_Other ":")} {(DQ ("[a-zA-Z]"))}]
                  redirects: [(Redir op_id:Redir_Great fd:-1 arg_word:{(/dev/null)} spids:[327])]
                )
              ]
              negated: True
            )
          ]
          spids: [302]
        )
      spids: [298 301]
    )
    (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">
        )
      }
    )
    (FuncDef
      name: parse_args
      body: 
        (BraceGroup
          children: [
            (Assignment
              keyword: Assign_None
              pairs: [
                (assign_pair
                  lhs: (LhsName name:test_expectation)
                  op: Equal
                  rhs: {(DQ (test_) ($ VSub_Number "$1"))}
                  spids: [497]
                )
              ]
              spids: [497]
            )
            (C {(shift)})
            (If
              arms: [
                (if_arm
                  cond: [(C {(test)} {(DQ ($ VSub_Number "$1"))} {(Lit_Other "=")} {(test_must_fail)})]
                  action: [
                    (Assignment
                      keyword: Assign_None
                      pairs: [
                        (assign_pair
                          lhs: (LhsName name:full_command)
                          op: Equal
                          rhs: {(DQ ("test_must_fail test_terminal "))}
                          spids: [523]
                        )
                      ]
                      spids: [523]
                    )
                    (C {(shift)})
                  ]
                  spids: [-1 520]
                )
              ]
              else_action: [
                (Assignment
                  keyword: Assign_None
                  pairs: [
                    (assign_pair
                      lhs: (LhsName name:full_command)
                      op: Equal
                      rhs: {(DQ ("test_terminal "))}
                      spids: [535]
                    )
                  ]
                  spids: [535]
                )
              ]
              spids: [532 541]
            )
            (Assignment
              keyword: Assign_None
              pairs: [
                (assign_pair
                  lhs: (LhsName name:cmd)
                  op: Equal
                  rhs: {($ VSub_Number "$1")}
                  spids: [544]
                )
              ]
              spids: [544]
            )
            (Assignment
              keyword: Assign_None
              pairs: [
                (assign_pair
                  lhs: (LhsName name:full_command)
                  op: Equal
                  rhs: {(DQ ($ VSub_Name "$full_command") (" ") ($ VSub_Number "$1"))}
                  spids: [548]
                )
              ]
              spids: [548]
            )
          ]
          spids: [494]
        )
      spids: [490 493]
    )
    (FuncDef
      name: test_default_pager
      body: 
        (BraceGroup
          children: [
            (C {(parse_args)} {(DQ ($ VSub_At "$@"))})
            (C {($ VSub_Name "$test_expectation")} {(SIMPLEPAGER) (Lit_Comma ",") (TTY)} 
              {(DQ ($ VSub_Name "$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 >") (EscapedLiteralPart token:<Lit_EscapedChar "\\$">) 
                  ("less <<-") (EscapedLiteralPart token:<Lit_EscapedChar "\\E">) ("OF &&\n") ("\t\t#!/bin/sh\n") 
                  ("\t\twc >default_pager_used\n") ("\t\tEOF\n") ("\t\tchmod +x ") (EscapedLiteralPart token:<Lit_EscapedChar "\\$">) ("less &&\n") 
                  ("\t\t(\n") ("\t\t\tPATH=.:") (EscapedLiteralPart token:<Lit_EscapedChar "\\$">) ("PATH &&\n") 
                  ("\t\t\texport PATH &&\n") ("\t\t\t") ($ VSub_Name "$full_command") ("\n") ("\t\t) &&\n") ("\t\ttest -e default_pager_used\n") ("\t")
                )
              }
            )
          ]
          spids: [562]
        )
      spids: [558 561]
    )
    (FuncDef
      name: test_PAGER_overrides
      body: 
        (BraceGroup
          children: [
            (C {(parse_args)} {(DQ ($ VSub_At "$@"))})
            (C {($ VSub_Name "$test_expectation")} {(TTY)} 
              {(DQ ($ VSub_Name "$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") ($ VSub_Name "$full_command") 
                  (" &&\n") ("\t\ttest -e PAGER_used\n") ("\t")
                )
              }
            )
          ]
          spids: [620]
        )
      spids: [616 619]
    )
    (FuncDef
      name: test_core_pager_overrides
      body: 
        (BraceGroup
          children: [
            (Assignment
              keyword: Assign_None
              pairs: [
                (assign_pair
                  lhs: (LhsName name:if_local_config)
                  op: Equal
                  rhs: {(SQ )}
                  spids: [664]
                )
              ]
              spids: [664]
            )
            (Assignment
              keyword: Assign_None
              pairs: [
                (assign_pair
                  lhs: (LhsName name:used_if_wanted)
                  op: Equal
                  rhs: {(SQ <"overrides PAGER">)}
                  spids: [667]
                )
              ]
              spids: [667]
            )
            (C {(test_core_pager)} {(DQ ($ VSub_At "$@"))})
          ]
          spids: [661]
        )
      spids: [657 660]
    )
    (FuncDef
      name: test_local_config_ignored
      body: 
        (BraceGroup
          children: [
            (Assignment
              keyword: Assign_None
              pairs: [
                (assign_pair
                  lhs: (LhsName name:if_local_config)
                  op: Equal
                  rhs: {(SQ <"! ">)}
                  spids: [689]
                )
              ]
              spids: [689]
            )
            (Assignment
              keyword: Assign_None
              pairs: [
                (assign_pair
                  lhs: (LhsName name:used_if_wanted)
                  op: Equal
                  rhs: {(SQ <"is not used">)}
                  spids: [695]
                )
              ]
              spids: [695]
            )
            (C {(test_core_pager)} {(DQ ($ VSub_At "$@"))})
          ]
          spids: [686]
        )
      spids: [682 685]
    )
    (FuncDef
      name: test_core_pager
      body: 
        (BraceGroup
          children: [
            (C {(parse_args)} {(DQ ($ VSub_At "$@"))})
            (C {($ VSub_Name "$test_expectation")} {(TTY)} 
              {
                (DQ ($ VSub_Name "$cmd") (" - repository-local core.pager setting ") 
                  ($ VSub_Name "$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") 
                  ($ VSub_Name "$full_command") (" &&\n") ("\t\t") (${ VSub_Name if_local_config) ("test -e core.pager_used\n") ("\t")
                )
              }
            )
          ]
          spids: [714]
        )
      spids: [710 713]
    )
    (FuncDef
      name: test_core_pager_subdir
      body: 
        (BraceGroup
          children: [
            (Assignment
              keyword: Assign_None
              pairs: [
                (assign_pair
                  lhs: (LhsName name:if_local_config)
                  op: Equal
                  rhs: {(SQ )}
                  spids: [763]
                )
              ]
              spids: [763]
            )
            (Assignment
              keyword: Assign_None
              pairs: [
                (assign_pair
                  lhs: (LhsName name:used_if_wanted)
                  op: Equal
                  rhs: {(SQ <"overrides PAGER">)}
                  spids: [766]
                )
              ]
              spids: [766]
            )
            (C {(test_pager_subdir_helper)} {(DQ ($ VSub_At "$@"))})
          ]
          spids: [760]
        )
      spids: [756 759]
    )
    (FuncDef
      name: test_no_local_config_subdir
      body: 
        (BraceGroup
          children: [
            (Assignment
              keyword: Assign_None
              pairs: [
                (assign_pair
                  lhs: (LhsName name:if_local_config)
                  op: Equal
                  rhs: {(SQ <"! ">)}
                  spids: [788]
                )
              ]
              spids: [788]
            )
            (Assignment
              keyword: Assign_None
              pairs: [
                (assign_pair
                  lhs: (LhsName name:used_if_wanted)
                  op: Equal
                  rhs: {(SQ <"is not used">)}
                  spids: [794]
                )
              ]
              spids: [794]
            )
            (C {(test_pager_subdir_helper)} {(DQ ($ VSub_At "$@"))})
          ]
          spids: [785]
        )
      spids: [781 784]
    )
    (FuncDef
      name: test_pager_subdir_helper
      body: 
        (BraceGroup
          children: [
            (C {(parse_args)} {(DQ ($ VSub_At "$@"))})
            (C {($ VSub_Name "$test_expectation")} {(TTY)} 
              {
                (DQ ($ VSub_Name "$cmd") (" - core.pager ") ($ VSub_Name "$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=") (EscapedLiteralPart token:<Lit_EscapedChar "\\$">) 
                  ("(pwd)/core.pager_used &&\n") ("\t\texport PAGER stampname &&\n") ("\t\ttest_config core.pager 'wc >") 
                  (EscapedLiteralPart token:<Lit_EscapedChar "\\\"">) (EscapedLiteralPart token:<Lit_EscapedChar "\\$">) (stampname) 
                  (EscapedLiteralPart token:<Lit_EscapedChar "\\\"">) ("' &&\n") ("\t\tmkdir sub &&\n") ("\t\t(\n") ("\t\t\tcd sub &&\n") ("\t\t\t") 
                  ($ VSub_Name "$full_command") ("\n") ("\t\t) &&\n") ("\t\t") (${ VSub_Name if_local_config) ("test -e core.pager_used\n") ("\t")
                )
              }
            )
          ]
          spids: [813]
        )
      spids: [809 812]
    )
    (FuncDef
      name: test_GIT_PAGER_overrides
      body: 
        (BraceGroup
          children: [
            (C {(parse_args)} {(DQ ($ VSub_At "$@"))})
            (C {($ VSub_Name "$test_expectation")} {(TTY)} 
              {(DQ ($ VSub_Name "$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") ($ VSub_Name "$full_command") (" &&\n") 
                  ("\t\ttest -e GIT_PAGER_used\n") ("\t")
                )
              }
            )
          ]
          spids: [873]
        )
      spids: [869 872]
    )
    (FuncDef
      name: test_doesnt_paginate
      body: 
        (BraceGroup
          children: [
            (C {(parse_args)} {(DQ ($ VSub_At "$@"))})
            (C {($ VSub_Name "$test_expectation")} {(TTY)} 
              {(DQ ("no pager for '") ($ VSub_Name "$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") ($ VSub_Name "$full_command") (" &&\n") 
                  ("\t\t! test -e GIT_PAGER_used\n") ("\t")
                )
              }
            )
          ]
          spids: [913]
        )
      spids: [909 912]
    )
    (FuncDef
      name: test_pager_choices
      body: 
        (BraceGroup
          children: [
            (C {(test_default_pager)} {(expect_success)} {(DQ ($ VSub_At "$@"))})
            (C {(test_PAGER_overrides)} {(expect_success)} {(DQ ($ VSub_At "$@"))})
            (C {(test_core_pager_overrides)} {(expect_success)} {(DQ ($ VSub_At "$@"))})
            (C {(test_core_pager_subdir)} {(expect_success)} {(DQ ($ VSub_At "$@"))})
            (C {(test_GIT_PAGER_overrides)} {(expect_success)} {(DQ ($ VSub_At "$@"))})
          ]
          spids: [953]
        )
      spids: [949 952]
    )
    (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)})
  ]
)