Merge branch 'jn/maint-setup-fix' (early part) into jn/paginate-fix
[gitweb.git] / t / t7006-pager.sh
index 6c86d7035ffa32d75bfd7e93f61299eafb2b3603..017565f3329795b9c8cd39b76fa03e2a16bb3067 100755 (executable)
@@ -58,6 +58,21 @@ test_expect_success TTY 'some commands use a pager' '
        test -e paginated.out
 '
 
+test_expect_failure TTY 'pager runs from subdir' '
+       echo subdir/paginated.out >expected &&
+       mkdir -p subdir &&
+       rm -f paginated.out subdir/paginated.out &&
+       (
+               cd subdir &&
+               test_terminal git log
+       ) &&
+       {
+               ls paginated.out subdir/paginated.out ||
+               :
+       } >actual &&
+       test_cmp expected actual
+'
+
 test_expect_success TTY 'some commands do not use a pager' '
        rm -f paginated.out ||
        cleanup_fail &&
@@ -119,6 +134,32 @@ test_expect_success TTY 'configuration can disable pager' '
        ! test -e paginated.out
 '
 
+test_expect_success 'git config uses a pager if configured to' '
+       rm -f paginated.out &&
+       git config pager.config true &&
+       test_when_finished "git config --unset pager.config" &&
+       test_terminal git config --list &&
+       test -e paginated.out
+'
+
+test_expect_success 'configuration can enable pager (from subdir)' '
+       rm -f paginated.out &&
+       mkdir -p subdir &&
+       git config pager.bundle true &&
+       test_when_finished "git config --unset pager.bundle" &&
+
+       git bundle create test.bundle --all &&
+       rm -f paginated.out subdir/paginated.out &&
+       (
+               cd subdir &&
+               test_terminal git bundle unbundle ../test.bundle
+       ) &&
+       {
+               test -e paginated.out ||
+               test -e subdir/paginated.out
+       }
+'
+
 # A colored commit log will begin with an appropriate ANSI escape
 # for the first color; the text "commit" comes later.
 colorful() {