Skip to content

Commit 561d952

Browse files
committed
Merge branch 'mm/pager-less-sans-S'
Since the very beginning of Git, we gave the LESS environment a default value "FRSX" when we spawn "less" as the pager. "S" (chop long lines instead of wrapping) has been removed from this default set of options, because it is more or less a personal taste thing, as opposed to others that have good justifications (i.e. "R" is very much justified because many kinds of output we produce are colored and "FX" is justified because output we produce is often shorter than a page). Existing users who prefer not to see line-wrapped output may want to set $ git config core.pager "less -S" to restore the traditional behaviour. It is expected that people find output from the most subcommands easier to read with the new default, except for "blame" which tends to produce really long lines. To override the new default only for "git blame", you can do this: $ git config pager.blame "less -S" * mm/pager-less-sans-S: pager: remove 'S' from $LESS by default
2 parents 79dcccc + b327583 commit 561d952

File tree

4 files changed

+13
-8
lines changed

4 files changed

+13
-8
lines changed

Documentation/config.txt

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -558,14 +558,19 @@ core.pager::
558558
configuration, then `$PAGER`, and then the default chosen at
559559
compile time (usually 'less').
560560
+
561-
When the `LESS` environment variable is unset, Git sets it to `FRSX`
561+
When the `LESS` environment variable is unset, Git sets it to `FRX`
562562
(if `LESS` environment variable is set, Git does not change it at
563563
all). If you want to selectively override Git's default setting
564-
for `LESS`, you can set `core.pager` to e.g. `less -+S`. This will
564+
for `LESS`, you can set `core.pager` to e.g. `less -S`. This will
565565
be passed to the shell by Git, which will translate the final
566-
command to `LESS=FRSX less -+S`. The environment tells the command
567-
to set the `S` option to chop long lines but the command line
568-
resets it to the default to fold long lines.
566+
command to `LESS=FRX less -S`. The environment does not set the
567+
`S` option but the command line does, instructing less to truncate
568+
long lines. Similarly, setting `core.pager` to `less -+F` will
569+
deactivate the `F` option specified by the environment from the
570+
command-line, deactivating the "quit if one screen" behavior of
571+
`less`. One can specifically activate some flags for particular
572+
commands: for example, setting `pager.blame` to `less -S` enables
573+
line truncation only for `git blame`.
569574
+
570575
Likewise, when the `LV` environment variable is unset, Git sets it
571576
to `-c`. You can override this setting by exporting `LV` with

git-sh-setup.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ git_pager() {
160160
else
161161
GIT_PAGER=cat
162162
fi
163-
: ${LESS=-FRSX}
163+
: ${LESS=-FRX}
164164
: ${LV=-c}
165165
export LESS LV
166166

pager.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ void setup_pager(void)
8585
int i = 0;
8686

8787
if (!getenv("LESS"))
88-
env[i++] = "LESS=FRSX";
88+
env[i++] = "LESS=FRX";
8989
if (!getenv("LV"))
9090
env[i++] = "LV=-c";
9191
env[i] = NULL;

perl/Git/SVN/Log.pm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ sub run_pager {
116116
return;
117117
}
118118
open STDIN, '<&', $rfd or fatal "Can't redirect stdin: $!";
119-
$ENV{LESS} ||= 'FRSX';
119+
$ENV{LESS} ||= 'FRX';
120120
$ENV{LV} ||= '-c';
121121
exec $pager or fatal "Can't run pager: $! ($pager)";
122122
}

0 commit comments

Comments
 (0)