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

[PATCH] pager_in_use: use git_env_bool()

From
Jeff King <peff@peff.net>
Date
Mar 24, 2017, 18:59 UTC
Message-ID
<20170324185912.rvzi46kr5ldxnehm@sigill.intra.peff.net>
In-Reply-To
<20170324185543.uq4clqyvbdkahbzo@sigill.intra.peff.net>
On Fri, Mar 24, 2017 at 02:55:43PM -0400, Jeff King wrote:
> But I was concerned that there might be a bug in pager_in_use(), so I
> dug into it a little. I think the code there is correct; [...]
I did see this small cleanup opportunity, though.
-- >8 --
Subject: [PATCH] pager_in_use: use git_env_bool()

The pager_in_use() function predates git_env_bool(), but ends up doing the same thing. Let's make use of the latter, which is shorter and less repetitive.

Signed-off-by: Jeff King <peff@peff.net>
---
 pager.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/pager.c b/pager.c
index 73ca8bc3b..c113d898a 100644
--- a/pager.c
+++ b/pager.c
@@ -135,9 +135,7 @@ void setup_pager(void)
 
 int pager_in_use(void)
 {
-	const char *env;
-	env = getenv("GIT_PAGER_IN_USE");
-	return env ? git_config_bool("GIT_PAGER_IN_USE", env) : 0;
+	return git_env_bool("GIT_PAGER_IN_USE", 0);
 }
 
 /*
-- 
2.12.1.843.g1937c56c2
Previous: Jeff KingNext: Junio C Hamano
Message 12 of 13 in “log: if --decorate is not given, default to --decorate=auto”
  1. log: if --decorate is not given, default to --decorate=autoAlex Henrie, Mar 21, 2017
  2. Junio C HamanoMar 21, 2017
  3. Junio C HamanoMar 21, 2017
  4. Alex HenrieMar 22, 2017
  5. Junio C HamanoMar 22, 2017
  6. Alex HenrieMar 23, 2017
  7. Junio C HamanoMar 23, 2017
  8. Alex HenrieMar 23, 2017
  9. Junio C HamanoMar 23, 2017
  10. Alex HenrieMar 24, 2017
  11. Jeff KingMar 24, 2017
  12. pager_in_use: use git_env_bool()Jeff King, Mar 24, 2017
  13. Junio C HamanoMar 24, 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.