(command.CommandList children: [ (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:test_description) op: Equal rhs: {(SQ <'Test automatic use of a pager.'>)} ) ] ) (C {(.)} {(./test-lib.sh)}) (C {(.)} {(DQ ($ VSub_DollarName '$TEST_DIRECTORY')) (/lib-pager.sh)}) (C {(.)} {(DQ ($ 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)} {(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'> ) } ) (command.FuncDef name: colorful body: (command.BraceGroup children: [ (command.SimpleCommand words: [{(read)} {(firstline)}] redirects: [(redir.Redir op:<Redir_Less '<'> fd:16777215 arg_word:{($ VSub_Number '$1')})] ) (command.Pipeline children: [ (command.SimpleCommand words: [ {(expr)} {(DQ ($ VSub_DollarName '$firstline'))} {(Lit_Other ':')} {(DQ ('[a-zA-Z]'))} ] redirects: [(redir.Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(/dev/null)})] ) ] 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.FuncDef name: parse_args body: (command.BraceGroup children: [ (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:test_expectation) op: Equal rhs: {(DQ (test_) ($ VSub_Number '$1'))} ) ] ) (C {(shift)}) (command.If arms: [ (if_arm cond: [(C {(test)} {(DQ ($ VSub_Number '$1'))} {(Lit_Other '=')} {(test_must_fail)})] action: [ (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:full_command) op: Equal rhs: {(DQ ('test_must_fail test_terminal '))} ) ] ) (C {(shift)}) ] ) ] else_action: [ (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:full_command) op: Equal rhs: {(DQ ('test_terminal '))} ) ] ) ] ) (command.Assignment keyword: Assign_None pairs: [(assign_pair lhs:(lhs_expr.LhsName name:cmd) op:Equal rhs:{($ VSub_Number '$1')})] ) (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:full_command) op: Equal rhs: {(DQ ($ VSub_DollarName '$full_command') (' ') ($ VSub_Number '$1'))} ) ] ) ] ) ) (command.FuncDef name: test_default_pager body: (command.BraceGroup children: [ (C {(parse_args)} {(DQ ($ VSub_At '$@'))}) (C {($ VSub_DollarName '$test_expectation')} {(SIMPLEPAGER) (Lit_Comma ',') (TTY)} {(DQ ($ 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.EscapedLiteralPart token:<Lit_EscapedChar '\\$'>) ('less <<-') (Lit_Other '\\') ('EOF &&\n') ('\t\t#!/bin/sh\n') ('\t\twc >default_pager_used\n') ('\t\tEOF\n') ('\t\tchmod +x ') (word_part.EscapedLiteralPart token:<Lit_EscapedChar '\\$'>) ('less &&\n') ('\t\t(\n') ('\t\t\tPATH=.:') (word_part.EscapedLiteralPart token:<Lit_EscapedChar '\\$'>) ('PATH &&\n') ('\t\t\texport PATH &&\n') ('\t\t\t') ($ VSub_DollarName '$full_command') ('\n') ('\t\t) &&\n') ('\t\ttest -e default_pager_used\n') ('\t') ) } ) ] ) ) (command.FuncDef name: test_PAGER_overrides body: (command.BraceGroup children: [ (C {(parse_args)} {(DQ ($ VSub_At '$@'))}) (C {($ VSub_DollarName '$test_expectation')} {(TTY)} {(DQ ($ 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') ($ VSub_DollarName '$full_command') (' &&\n') ('\t\ttest -e PAGER_used\n') ('\t') ) } ) ] ) ) (command.FuncDef name: test_core_pager_overrides body: (command.BraceGroup children: [ (command.Assignment keyword: Assign_None pairs: [(assign_pair lhs:(lhs_expr.LhsName name:if_local_config) op:Equal rhs:(word.EmptyWord))] ) (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:used_if_wanted) op: Equal rhs: {(SQ <'overrides PAGER'>)} ) ] ) (C {(test_core_pager)} {(DQ ($ VSub_At '$@'))}) ] ) ) (command.FuncDef name: test_local_config_ignored body: (command.BraceGroup children: [ (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:if_local_config) op: Equal rhs: {(SQ <'! '>)} ) ] ) (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:used_if_wanted) op: Equal rhs: {(SQ <'is not used'>)} ) ] ) (C {(test_core_pager)} {(DQ ($ VSub_At '$@'))}) ] ) ) (command.FuncDef name: test_core_pager body: (command.BraceGroup children: [ (C {(parse_args)} {(DQ ($ VSub_At '$@'))}) (C {($ VSub_DollarName '$test_expectation')} {(TTY)} { (DQ ($ VSub_DollarName '$cmd') (' - repository-local core.pager setting ') ($ 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') ($ VSub_DollarName '$full_command') (' &&\n') ('\t\t') (${ VSub_Name if_local_config) ('test -e core.pager_used\n') ('\t') ) } ) ] ) ) (command.FuncDef name: test_core_pager_subdir body: (command.BraceGroup children: [ (command.Assignment keyword: Assign_None pairs: [(assign_pair lhs:(lhs_expr.LhsName name:if_local_config) op:Equal rhs:(word.EmptyWord))] ) (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:used_if_wanted) op: Equal rhs: {(SQ <'overrides PAGER'>)} ) ] ) (C {(test_pager_subdir_helper)} {(DQ ($ VSub_At '$@'))}) ] ) ) (command.FuncDef name: test_no_local_config_subdir body: (command.BraceGroup children: [ (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:if_local_config) op: Equal rhs: {(SQ <'! '>)} ) ] ) (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:used_if_wanted) op: Equal rhs: {(SQ <'is not used'>)} ) ] ) (C {(test_pager_subdir_helper)} {(DQ ($ VSub_At '$@'))}) ] ) ) (command.FuncDef name: test_pager_subdir_helper body: (command.BraceGroup children: [ (C {(parse_args)} {(DQ ($ VSub_At '$@'))}) (C {($ VSub_DollarName '$test_expectation')} {(TTY)} { (DQ ($ VSub_DollarName '$cmd') (' - core.pager ') ($ 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.EscapedLiteralPart token:<Lit_EscapedChar '\\$'>) ('(pwd)/core.pager_used &&\n') ('\t\texport PAGER stampname &&\n') ("\t\ttest_config core.pager 'wc >") (word_part.EscapedLiteralPart token:<Lit_EscapedChar '\\"'>) (word_part.EscapedLiteralPart token:<Lit_EscapedChar '\\$'>) (stampname) (word_part.EscapedLiteralPart token:<Lit_EscapedChar '\\"'>) ("' &&\n") ('\t\tmkdir sub &&\n') ('\t\t(\n') ('\t\t\tcd sub &&\n') ('\t\t\t') ($ VSub_DollarName '$full_command') ('\n') ('\t\t) &&\n') ('\t\t') (${ VSub_Name if_local_config) ('test -e core.pager_used\n') ('\t') ) } ) ] ) ) (command.FuncDef name: test_GIT_PAGER_overrides body: (command.BraceGroup children: [ (C {(parse_args)} {(DQ ($ VSub_At '$@'))}) (C {($ VSub_DollarName '$test_expectation')} {(TTY)} {(DQ ($ 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') ($ VSub_DollarName '$full_command') (' &&\n') ('\t\ttest -e GIT_PAGER_used\n') ('\t') ) } ) ] ) ) (command.FuncDef name: test_doesnt_paginate body: (command.BraceGroup children: [ (C {(parse_args)} {(DQ ($ VSub_At '$@'))}) (C {($ VSub_DollarName '$test_expectation')} {(TTY)} {(DQ ("no pager for '") ($ 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') ($ VSub_DollarName '$full_command') (' &&\n') ('\t\t! test -e GIT_PAGER_used\n') ('\t') ) } ) ] ) ) (command.FuncDef name: test_pager_choices body: (command.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 '$@'))}) ] ) ) (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)}) ] )