summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 2d3ca21)
raw | patch | inline | side by side (parent: 2d3ca21)
author | Jonathan Nieder <jrnieder@gmail.com> | |
Mon, 22 Feb 2010 08:46:33 +0000 (02:46 -0600) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Mon, 22 Feb 2010 22:19:28 +0000 (14:19 -0800) |
Pagers that do not consume their input are dangerous: for example,
$ GIT_PAGER=: git log
$ echo $?
141
$
The only reason these tests were able to work before was that
'git log' would write to the pipe (and not fill it) before the
pager had time to terminate and close the pipe.
Fix it by using a program that consumes its input, namely wc (as
suggested by Johannes).
Reported-by: Johannes Sixt <j.sixt@viscovery.net>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
$ GIT_PAGER=: git log
$ echo $?
141
$
The only reason these tests were able to work before was that
'git log' would write to the pipe (and not fill it) before the
pager had time to terminate and close the pipe.
Fix it by using a program that consumes its input, namely wc (as
suggested by Johannes).
Reported-by: Johannes Sixt <j.sixt@viscovery.net>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/t7006-pager.sh | patch | blob | history |
diff --git a/t/t7006-pager.sh b/t/t7006-pager.sh
index da0f96262dfa8a238da5c91c2ca0e5ce91d92e6a..d9202d5af5a179ca0b77d6509e05cbe6bf092ccc 100755 (executable)
--- a/t/t7006-pager.sh
+++ b/t/t7006-pager.sh
test_expect_success SIMPLEPAGER 'default pager is used by default' '
cat > $less <<-EOF &&
#!$SHELL_PATH
- : > default_pager_used
+ wc > default_pager_used
EOF
chmod +x $less &&
PATH=.:$PATH test_terminal git log &&
git config --unset core.pager
rm -f PAGER_used
test_expect_success TTY 'PAGER overrides default pager' '
- PAGER=": > PAGER_used" &&
+ PAGER="wc > PAGER_used" &&
export PAGER &&
test_terminal git log &&
test -e PAGER_used
unset GIT_PAGER
rm -f core.pager_used
test_expect_success TTY 'core.pager overrides PAGER' '
- PAGER=: &&
+ PAGER=wc &&
export PAGER &&
- git config core.pager ": > core.pager_used" &&
+ git config core.pager "wc > core.pager_used" &&
test_terminal git log &&
test -e core.pager_used
'
rm -f GIT_PAGER_used
test_expect_success TTY 'GIT_PAGER overrides core.pager' '
- git config core.pager : &&
- GIT_PAGER=": > GIT_PAGER_used" &&
+ git config core.pager wc &&
+ GIT_PAGER="wc > GIT_PAGER_used" &&
export GIT_PAGER &&
test_terminal git log &&
test -e GIT_PAGER_used