Skip to content

Commit 33935dc

Browse files
committed
Merge branch 'tc/format-patch-p'
* tc/format-patch-p: format-patch: page output with --stdout
2 parents 1e86274 + 38a94bb commit 33935dc

2 files changed

Lines changed: 25 additions & 0 deletions

File tree

builtin/log.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1158,6 +1158,8 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
11581158

11591159
if (!use_stdout)
11601160
output_directory = set_outdir(prefix, output_directory);
1161+
else
1162+
setup_pager();
11611163

11621164
if (output_directory) {
11631165
if (use_stdout)

t/t4014-format-patch.sh

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
test_description='various format-patch tests'
77

88
. ./test-lib.sh
9+
. "$TEST_DIRECTORY"/lib-terminal.sh
910

1011
test_expect_success setup '
1112
@@ -686,4 +687,26 @@ test_expect_success 'format-patch --signature="" supresses signatures' '
686687
! grep "^-- \$" output
687688
'
688689

690+
test_expect_success TTY 'format-patch --stdout paginates' '
691+
rm -f pager_used &&
692+
(
693+
GIT_PAGER="wc >pager_used" &&
694+
export GIT_PAGER &&
695+
test_terminal git format-patch --stdout --all
696+
) &&
697+
test_path_is_file pager_used
698+
'
699+
700+
test_expect_success TTY 'format-patch --stdout pagination can be disabled' '
701+
rm -f pager_used &&
702+
(
703+
GIT_PAGER="wc >pager_used" &&
704+
export GIT_PAGER &&
705+
test_terminal git --no-pager format-patch --stdout --all &&
706+
test_terminal git -c "pager.format-patch=false" format-patch --stdout --all
707+
) &&
708+
test_path_is_missing pager_used &&
709+
test_path_is_missing .git/pager_used
710+
'
711+
689712
test_done

0 commit comments

Comments
 (0)