mirror of
https://gerrit.googlesource.com/git-repo
synced 2026-06-05 01:19:50 +00:00
pager: set $LESS only when missing
This matches the git behavior. From [1], > When the `LESS` environment variable is unset, Git sets it to `FRX` > (if `LESS` environment variable is set, Git does not change it at > all). The default $LESS is changed from FRSX to FRX since git 2.1.0 [2]. This change also updates the default $LESS for repo. [1] https://git-scm.com/docs/git-config#Documentation/git-config.txt-corepager [2] https://github.com/git/git/commit/b3275838d969b7ecb91aae584226fccbeb046aca Bug: https://crbug.com/gerrit/16973 Change-Id: I64ccaa7b034fdb6a92c10025e47f5d07e85e6451 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/374894 Reviewed-by: Chih-Hsuan Yen <x5f4qvj3w3ge2tiq@chyen.cc> Reviewed-by: Mike Frysinger <vapier@google.com> Tested-by: Chih-Hsuan Yen <x5f4qvj3w3ge2tiq@chyen.cc>
This commit is contained in:
@@ -118,7 +118,10 @@ def _BecomePager(pager):
|
||||
# available versions of 'less', a better 'more'.
|
||||
_a, _b, _c = select.select([0], [], [0])
|
||||
|
||||
os.environ["LESS"] = "FRSX"
|
||||
# This matches the behavior of git, which sets $LESS to `FRX` if it is not
|
||||
# set. See:
|
||||
# https://git-scm.com/docs/git-config#Documentation/git-config.txt-corepager
|
||||
os.environ.setdefault("LESS", "FRX")
|
||||
|
||||
try:
|
||||
os.execvp(pager, [pager])
|
||||
|
||||
Reference in New Issue
Block a user