Merge branch 'tc/format-patch-p'
authorJunio C Hamano <gitster@pobox.com>
Mon, 13 Dec 2010 05:49:52 +0000 (21:49 -0800)
committerJunio C Hamano <gitster@pobox.com>
Mon, 13 Dec 2010 05:49:52 +0000 (21:49 -0800)
* tc/format-patch-p:
format-patch: page output with --stdout

builtin/log.c
t/t4014-format-patch.sh
index 4191d9c4e55c0745b96e8f93161ea10fb4ec7e0d..d8c6c28d2fcc3bd0744f071da536215141dc0d0b 100644 (file)
@@ -1158,6 +1158,8 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
 
        if (!use_stdout)
                output_directory = set_outdir(prefix, output_directory);
+       else
+               setup_pager();
 
        if (output_directory) {
                if (use_stdout)
index 07bf6eb49dd2879758f64a8c09a0ae8d7e54dd45..027c13d52cd701ba28e3c5e29c5431acfccdad73 100755 (executable)
@@ -6,6 +6,7 @@
 test_description='various format-patch tests'
 
 . ./test-lib.sh
+. "$TEST_DIRECTORY"/lib-terminal.sh
 
 test_expect_success setup '
 
@@ -686,4 +687,26 @@ test_expect_success 'format-patch --signature="" supresses signatures' '
        ! grep "^-- \$" output
 '
 
+test_expect_success TTY 'format-patch --stdout paginates' '
+       rm -f pager_used &&
+       (
+               GIT_PAGER="wc >pager_used" &&
+               export GIT_PAGER &&
+               test_terminal git format-patch --stdout --all
+       ) &&
+       test_path_is_file pager_used
+'
+
+ test_expect_success TTY 'format-patch --stdout pagination can be disabled' '
+       rm -f pager_used &&
+       (
+               GIT_PAGER="wc >pager_used" &&
+               export GIT_PAGER &&
+               test_terminal git --no-pager format-patch --stdout --all &&
+               test_terminal git -c "pager.format-patch=false" format-patch --stdout --all
+       ) &&
+       test_path_is_missing pager_used &&
+       test_path_is_missing .git/pager_used
+'
+
 test_done