threads / patch / 14579

patchAllow pager of diff command be enabled/disabled

Subject: [PATCH] Allow pager of diff command be enabled/disabled

## tl;dr

2 messages between Jul 21, 2008 and Jul 22, 2008. Diffs are folded; open one to read it.

replies: 1people: 2as markdown or json

Alex Riesen· Jul 21, 2008, 21:28 UTC · lore

See for example, status and show commands. Besides, Documentation/RelNotes-1.6.0.txt mentions that pager.<cmd> can be used to enable/disable paging behavior per command.

Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
---

Also, really export check_pager_config, which just got another call site.

 builtin-diff.c |    3 ++-
 builtin.h      |    1 +
 2 files changed, 3 insertions(+), 1 deletions(-)
Show changes to 2 files +3 −1

builtin-diff.c, builtin.h

diff --git a/builtin-diff.c b/builtin-diff.c
index faaa85a..7ffea97 100644
--- a/builtin-diff.c
+++ b/builtin-diff.c
@@ -296,7 +296,8 @@ int cmd_diff(int argc, const char **argv, const char *prefix)
 	 * If the user asked for our exit code then don't start a
 	 * pager or we would end up reporting its exit code instead.
 	 */
-	if (!DIFF_OPT_TST(&rev.diffopt, EXIT_WITH_STATUS))
+	if (!DIFF_OPT_TST(&rev.diffopt, EXIT_WITH_STATUS) &&
+	    check_pager_config("diff") != 0)
 		setup_pager();
 
 	/*
diff --git a/builtin.h b/builtin.h
index 0e605d4..f3502d3 100644
--- a/builtin.h
+++ b/builtin.h
@@ -18,6 +18,7 @@ extern int fmt_merge_msg(int merge_summary, struct strbuf *in,
 	struct strbuf *out);
 extern int commit_tree(const char *msg, unsigned char *tree,
 		struct commit_list *parents, unsigned char *ret);
+extern int check_pager_config(const char *cmd);
 
 extern int cmd_add(int argc, const char **argv, const char *prefix);
 extern int cmd_annotate(int argc, const char **argv, const char *prefix);
-- 
1.6.0.rc0.24.g1329.dirty
Jeff King· Jul 22, 2008, 04:58 UTC · re: Alex Riesen · lore

Re: [PATCH] Allow pager of diff command be enabled/disabled

On Mon, Jul 21, 2008 at 11:28:49PM +0200, Alex Riesen wrote:
Show 9 quoted lines
> See for example, status and show commands. Besides,
> Documentation/RelNotes-1.6.0.txt mentions that pager.<cmd>
> can be used to enable/disable paging behavior per command.
> 
> Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
> ---
> 
> Also, really export check_pager_config, which just got another call
> site.

This patch looks correct to me. There are also a bunch of other commands for which pager.* doesn't work. Basically, anything that doesn't ask for RUN_SETUP is on its own to set up paging if it wants (because Bad Things happen when we try to look in the config before setup has been run).

Most of them people probably don't care about (really, who wants paging by default on git-apply?). But it is yet another hidden inconsistency from the paging patch.

-Peff

← back to recent threads