git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 1/4] t7006: document that `pager.foo` can be partially preserved

From
MÅMartin Ågren <martin.agren@gmail.com>
Date
Nov 5, 2017, 11:58 UTC
Message-ID
<a785966f0ffa966661e4022c077f81c46db3bb98.1509879269.git.martin.agren@gmail.com>
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
Previous: Martin ÅgrenNext: Martin Ågren
Message 5 of 11 in “Git Open Source Weekend London 11th/12th November”
  1. Thomas GummererNov 1, 2017
  2. Jeff KingNov 4, 2017
  3. Philip OakleyNov 4, 2017
  4. 0/4 first steps towards pager.foo.{command,enable}Martin Ågren, Nov 5, 2017
  5. 1/4 t7006: document that `pager.foo` can be partially preservedMartin Ågren, Nov 5, 2017
  6. 2/4 pager: refactor `pager_command_config()`Martin Ågren, Nov 5, 2017
  7. 3/4 pager: introduce `pager.*.command` and `.enable`Martin Ågren, Nov 5, 2017
  8. 4/4 pager: make `pager.foo.command` imply `.enable=true`Martin Ågren, Nov 5, 2017
  9. Jeff KingNov 6, 2017
  10. Martin ÅgrenNov 7, 2017
  11. Patrick SteinhardtNov 5, 2017

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.