Assuming a blank slate, consider the following configuration:

[pager]
        foo = some-command
        foo = false

Now `git -c pager.foo=true foo` will page using `some-command`. This
might have been intended, or is perhaps just a side-effect of the
implementation. In any case, it could be useful and someone might rely
on it, either knowingly (as above) or not (if these lines are spread out
across the configuration).

However, `git --paginate foo` will *not* use `some-command`. That
matches the documentation (Documentation/git.txt).

Upcoming commits will expand on how paging for `git foo` can be
configured. Those commits mustn't change how `pager.foo` behaves, so add
tests for these two cases.

Signed-off-by: Martin Ågren <martin.ag...@gmail.com>
---
 t/t7006-pager.sh | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/t/t7006-pager.sh b/t/t7006-pager.sh
index f0f1abd1c..e890b2f64 100755
--- a/t/t7006-pager.sh
+++ b/t/t7006-pager.sh
@@ -117,6 +117,24 @@ test_expect_success TTY 'git config uses a pager if 
configured to' '
        test -e paginated.out
 '
 
+test_expect_success TTY 'configuration remembers pager across boolean changes' 
'
+       echo paging >expected &&
+       test_unconfig pager.config &&
+       test_terminal git -c pager.config="echo paging" \
+                         -c pager.config=false \
+                         -c pager.config \
+                         config --list >actual &&
+       test_cmp expected actual
+'
+
+test_expect_success TTY '--paginate does not respect inactivated pager' '
+       rm -f paginated.out &&
+       test_terminal git -c pager.config=bad \
+                         -c pager.config=false \
+                         --paginate config --list &&
+       test -e paginated.out
+'
+
 test_expect_success TTY 'configuration can enable pager (from subdir)' '
        rm -f paginated.out &&
        mkdir -p subdir &&
-- 
2.15.0.415.gac1375d7e

Reply via email to