Skip to content
This repository was archived by the owner on Nov 9, 2017. It is now read-only.

Commit 5b58619

Browse files
jrngitster
authored andcommitted
var doc: advertise current DEFAULT_PAGER and DEFAULT_EDITOR settings
Document the default pager and editor chosen at compile time in the git-var(1) manpage so users curious about what command _this_ copy of git will fall back to when EDITOR, VISUAL, and PAGER are unset can find the answer quickly. In builds leaving those settings uncustomized, this patch makes the manpage continue to say "usually vi" and "usually less" so the formatted documentation is usable for a wide audience including users of custom builds that change those settings. If you would like your copy of the docs to be less noncommittal, you will need to set DEFAULT_PAGER=less and DEFAULT_EDITOR=vi explicitly. Suggested-by: Junio C Hamano <[email protected]> Signed-off-by: Jonathan Nieder <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 4e0ce4d commit 5b58619

File tree

3 files changed

+18
-0
lines changed

3 files changed

+18
-0
lines changed

Documentation/Makefile

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,16 @@ SHELL_PATH ?= $(SHELL)
124124
# Shell quote;
125125
SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH))
126126

127+
ifdef DEFAULT_PAGER
128+
DEFAULT_PAGER_SQ = $(subst ','\'',$(DEFAULT_PAGER))
129+
ASCIIDOC_EXTRA += -a 'git-default-pager=$(DEFAULT_PAGER_SQ)'
130+
endif
131+
132+
ifdef DEFAULT_EDITOR
133+
DEFAULT_EDITOR_SQ = $(subst ','\'',$(DEFAULT_EDITOR))
134+
ASCIIDOC_EXTRA += -a 'git-default-editor=$(DEFAULT_EDITOR_SQ)'
135+
endif
136+
127137
#
128138
# Please note that there is a minor bug in asciidoc.
129139
# The version after 6.0.3 _will_ include the patch found here:

Documentation/git-var.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,19 @@ GIT_EDITOR::
4545
environment variable, then `core.editor` configuration, then
4646
`$VISUAL`, then `$EDITOR`, and then the default chosen at compile
4747
time, which is usually 'vi'.
48+
ifdef::git-default-editor[]
49+
The build you are using chose '{git-default-editor}' as the default.
50+
endif::git-default-editor[]
4851

4952
GIT_PAGER::
5053
Text viewer for use by git commands (e.g., 'less'). The value
5154
is meant to be interpreted by the shell. The order of preference
5255
is the `$GIT_PAGER` environment variable, then `core.pager`
5356
configuration, then `$PAGER`, and then the default chosen at
5457
compile time (usually 'less').
58+
ifdef::git-default-pager[]
59+
The build you are using chose '{git-default-pager}' as the default.
60+
endif::git-default-pager[]
5561

5662
Diagnostics
5763
-----------

Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2191,6 +2191,8 @@ $(XDIFF_LIB): $(XDIFF_OBJS)
21912191
$(VCSSVN_LIB): $(VCSSVN_OBJS)
21922192
$(QUIET_AR)$(RM) $@ && $(AR) rcs $@ $(VCSSVN_OBJS)
21932193

2194+
export DEFAULT_EDITOR DEFAULT_PAGER
2195+
21942196
doc:
21952197
$(MAKE) -C Documentation all
21962198

0 commit comments

Comments
 (0)