git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: "Martin Ågren" <martin.agren@gmail.com>
To: Jeff King <peff@peff.net>
Cc: git@vger.kernel.org, hkleynhans@bloomberg.net,
	Thomas Gummerer <t.gummerer@gmail.com>
Subject: [PATCH 1/4] t7006: document that `pager.foo` can be partially preserved
Date: Sun,  5 Nov 2017 12:58:19 +0100	[thread overview]
Message-ID: <a785966f0ffa966661e4022c077f81c46db3bb98.1509879269.git.martin.agren@gmail.com> (raw)
In-Reply-To: <cover.1509879269.git.martin.agren@gmail.com>

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.agren@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	other threads:[~2017-11-05 11:58 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-01 16:36 Git Open Source Weekend London 11th/12th November Thomas Gummerer
2017-11-04  9:28 ` Jeff King
2017-11-04 17:15   ` Philip Oakley
2017-11-05 11:58   ` [PATCH/DONOTAPPLY 0/4] first steps towards pager.foo.{command,enable} Martin Ågren
2017-11-05 11:58     ` Martin Ågren [this message]
2017-11-05 11:58     ` [PATCH 2/4] pager: refactor `pager_command_config()` Martin Ågren
2017-11-05 11:58     ` [PATCH 3/4] pager: introduce `pager.*.command` and `.enable` Martin Ågren
2017-11-05 11:58     ` [PATCH 4/4] pager: make `pager.foo.command` imply `.enable=true` Martin Ågren
2017-11-06 10:48     ` [PATCH/DONOTAPPLY 0/4] first steps towards pager.foo.{command,enable} Jeff King
2017-11-07 20:46       ` Martin Ågren
2017-11-05 12:42 ` Git Open Source Weekend London 11th/12th November Patrick Steinhardt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a785966f0ffa966661e4022c077f81c46db3bb98.1509879269.git.martin.agren@gmail.com \
    --to=martin.agren@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=hkleynhans@bloomberg.net \
    --cc=peff@peff.net \
    --cc=t.gummerer@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).