t7006: add tests for how git branch paginates

The next couple of commits will change how `git branch` handles `pager.branch`, similar to how de121ffe5 (tag: respect `pager.tag` in list-mode only, 2017-08-02) and ff1e72483 (tag: change default of `pager.tag` to "on", 2017-08-02) changed `git tag`. Add tests in this area to make sure that we don't regress and so that the upcoming commits can be made clearer by adapting the tests. Add some tests for `--list` (implied), one for `--edit-description`, and one for `--set-upstream-to` as a representative of "something other than the first two". In particular, use `test_expect_failure` to document that we currently respect the pager-configuration with `--edit-description`. The current behavior is buggy since the pager interferes with the editor and makes the end result completely broken. See also b3ee740c8 (t7006: add tests for how git tag paginates, 2017-08-02). Signed-off-by: Martin Ågren <martin.agren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Martin Ågren committed Nov 19, 2017 at 16:03 UTC ed104fa9e1016f8ac5f85642ed11e16b09510bea
1 file changed +38
t/t7006-pager.sh
+38
@@ -214,6 +214,44 @@ test_expect_success TTY 'git tag as alias respects pager.tag with -l' '
214 ! test -e paginated.out
215 '
216
217 +test_expect_success TTY 'git branch defaults to not paging' '
218 + rm -f paginated.out &&
219 + test_terminal git branch &&
220 + ! test -e paginated.out
221 +'
222 +
223 +test_expect_success TTY 'git branch respects pager.branch' '
224 + rm -f paginated.out &&
225 + test_terminal git -c pager.branch branch &&
226 + test -e paginated.out
227 +'
228 +
229 +test_expect_success TTY 'git branch respects --no-pager' '
230 + rm -f paginated.out &&
231 + test_terminal git -c pager.branch --no-pager branch &&
232 + ! test -e paginated.out
233 +'
234 +
235 +test_expect_failure TTY 'git branch --edit-description ignores pager.branch' '
236 + rm -f paginated.out editor.used &&
237 + write_script editor <<-\EOF &&
238 + echo "New description" >"$1"
239 + touch editor.used
240 + EOF
241 + EDITOR=./editor test_terminal git -c pager.branch branch --edit-description &&
242 + ! test -e paginated.out &&
243 + test -e editor.used
244 +'
245 +
246 +test_expect_success TTY 'git branch --set-upstream-to respects pager.branch' '
247 + rm -f paginated.out &&
248 + git branch other &&
249 + test_when_finished "git branch -D other" &&
250 + test_terminal git -c pager.branch branch --set-upstream-to=other &&
251 + test_when_finished "git branch --unset-upstream" &&
252 + test -e paginated.out
253 +'
254 +
255 # A colored commit log will begin with an appropriate ANSI escape
256 # for the first color; the text "commit" comes later.
257 colorful() {