Skip to content

Commit 7213c28

Browse files
j6tgitster
authored andcommitted
git: add -P as a short option for --no-pager
It is possible to configure 'less', the pager, to use an alternate screen to show the content, for example, by setting LESS=RS in the environment. When it is closed in this configuration, it switches back to the original screen, and all content is gone. It is not uncommon to request that the output remains visible in the terminal. For this, the option --no-pager can be used. But it is a bit cumbersome to type, even when command completion is available. Provide a short option, -P, to make the option more easily accessible. Signed-off-by: Johannes Sixt <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 468165c commit 7213c28

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

Documentation/git.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ SYNOPSIS
1111
[verse]
1212
'git' [--version] [--help] [-C <path>] [-c <name>=<value>]
1313
[--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]
14-
[-p|--paginate|--no-pager] [--no-replace-objects] [--bare]
14+
[-p|--paginate|-P|--no-pager] [--no-replace-objects] [--bare]
1515
[--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>]
1616
[--super-prefix=<path>]
1717
<command> [<args>]
@@ -103,6 +103,7 @@ foo.bar= ...`) sets `foo.bar` to the empty string which `git config
103103
configuration options (see the "Configuration Mechanism" section
104104
below).
105105

106+
-P::
106107
--no-pager::
107108
Do not pipe Git output into a pager.
108109

git.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
const char git_usage_string[] =
88
N_("git [--version] [--help] [-C <path>] [-c <name>=<value>]\n"
99
" [--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]\n"
10-
" [-p | --paginate | --no-pager] [--no-replace-objects] [--bare]\n"
10+
" [-p | --paginate | -P | --no-pager] [--no-replace-objects] [--bare]\n"
1111
" [--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>]\n"
1212
" <command> [<args>]");
1313

@@ -81,7 +81,7 @@ static int handle_options(const char ***argv, int *argc, int *envchanged)
8181
exit(0);
8282
} else if (!strcmp(cmd, "-p") || !strcmp(cmd, "--paginate")) {
8383
use_pager = 1;
84-
} else if (!strcmp(cmd, "--no-pager")) {
84+
} else if (!strcmp(cmd, "-P") || !strcmp(cmd, "--no-pager")) {
8585
use_pager = 0;
8686
if (envchanged)
8787
*envchanged = 1;

0 commit comments

Comments
 (0)