Skip to content

Commit 8f0359f

Browse files
raalkmlgitster
authored andcommitted
Allow pager of diff command be enabled/disabled
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 0dda1d1 commit 8f0359f

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

builtin-diff.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,8 @@ int cmd_diff(int argc, const char **argv, const char *prefix)
296296
* If the user asked for our exit code then don't start a
297297
* pager or we would end up reporting its exit code instead.
298298
*/
299-
if (!DIFF_OPT_TST(&rev.diffopt, EXIT_WITH_STATUS))
299+
if (!DIFF_OPT_TST(&rev.diffopt, EXIT_WITH_STATUS) &&
300+
check_pager_config("diff") != 0)
300301
setup_pager();
301302

302303
/*

builtin.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ extern int fmt_merge_msg(int merge_summary, struct strbuf *in,
1818
struct strbuf *out);
1919
extern int commit_tree(const char *msg, unsigned char *tree,
2020
struct commit_list *parents, unsigned char *ret);
21+
extern int check_pager_config(const char *cmd);
2122

2223
extern int cmd_add(int argc, const char **argv, const char *prefix);
2324
extern int cmd_annotate(int argc, const char **argv, const char *prefix);

0 commit comments

Comments
 (0)