Signed-off-by: Avishay Matayev <me@xxxxxxxxxxx> --- t/t9904-git-force-tty.sh | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100755 t/t9904-git-force-tty.sh diff --git a/t/t9904-git-force-tty.sh b/t/t9904-git-force-tty.sh new file mode 100755 index 0000000000..c954e27c9a --- /dev/null +++ b/t/t9904-git-force-tty.sh @@ -0,0 +1,38 @@ +#!/bin/sh + +test_description='Test GIT_FORCE_TTY' + +. ./test-lib.sh + +test_expect_success 'setup' ' + echo test_data > test_file && + git add test_file && + git commit -m first +' + +test_expect_success 'no output without force' ' + GIT_FORCE_TTY=0 GIT_PAGER="cat - > log_data" git log > /dev/null && + test ! -f log_data +' + +test_expect_success 'output with force' ' + GIT_FORCE_TTY=1 GIT_PAGER="cat - > log_data2" git log > /dev/null && + test -f log_data2 +' + +test_expect_success 'cant tell pager present in git reflog without force' ' + GIT_FORCE_TTY=false PAGER="touch pager2" git reflog > /dev/null && + test ! -f pager2 +' + +test_expect_success 'pager present in git reflog' ' + GIT_FORCE_TTY=yes PAGER="touch pager" git reflog > /dev/null && + test -f pager +' + +test_expect_success 'pager not present in git reflog expire' ' + GIT_FORCE_TTY=true PAGER="touch pager3" git reflog expire > /dev/null && + test ! -f pager3 +' + +test_done -- 2.25.1