aboutsummaryrefslogtreecommitdiff
path: root/t/t4014-format-patch.sh
diff options
context:
space:
mode:
authorTay Ray Chuan <rctay89@gmail.com>2010-11-23 11:16:30 +0800
committerJunio C Hamano <gitster@pobox.com>2010-11-23 12:17:03 -0800
commit38a94bb6bae683ba5a92969e63f1d3f2cbf41ac0 (patch)
treece79291b650ba65ea4b0e87bc5325040988987a9 /t/t4014-format-patch.sh
parent03276d94bcdb7d463a029936933898948c0669ac (diff)
downloadgit-38a94bb6bae683ba5a92969e63f1d3f2cbf41ac0.tar.gz
git-38a94bb6bae683ba5a92969e63f1d3f2cbf41ac0.tar.xz
format-patch: page output with --stdout
Pass output through the pager if format-patch is run with --stdout. This saves the user the trouble of running git with '-p' or piping through a pager. setup_pager() already checks if stdout is a tty, so we don't have to worry about behaviour if the user redirects/pipes stdout. Paging can also be disabled with the config [pager] format-patch = false Add tests to check for these behaviour. Helped-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Tay Ray Chuan <rctay89@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t4014-format-patch.sh')
-rwxr-xr-xt/t4014-format-patch.sh23
1 files changed, 23 insertions, 0 deletions
diff --git a/t/t4014-format-patch.sh b/t/t4014-format-patch.sh
index 07bf6eb49..027c13d52 100755
--- a/t/t4014-format-patch.sh
+++ b/t/t4014-format-patch.sh
@@ -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