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 <gitster@pobox.com> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Jonathan Nieder committed Mar 31, 2012 at 03:44 UTC 5b58619aa011c2047e7b67ca28630d8a2e72ca1f
3 files changed +18
Documentation/Makefile
+10
@@ -124,6 +124,16 @@ SHELL_PATH ?= $(SHELL)
124 # Shell quote;
125 SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH))
126
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 +
137 #
138 # Please note that there is a minor bug in asciidoc.
139 # The version after 6.0.3 _will_ include the patch found here:
Documentation/git-var.txt
+6
@@ -45,6 +45,9 @@ GIT_EDITOR::
45 environment variable, then `core.editor` configuration, then
46 `$VISUAL`, then `$EDITOR`, and then the default chosen at compile
47 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[]
51
52 GIT_PAGER::
53 Text viewer for use by git commands (e.g., 'less'). The value
@@ -52,6 +55,9 @@ GIT_PAGER::
55 is the `$GIT_PAGER` environment variable, then `core.pager`
56 configuration, then `$PAGER`, and then the default chosen at
57 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[]
61
62 Diagnostics
63 -----------
Makefile
+2
@@ -2191,6 +2191,8 @@ $(XDIFF_LIB): $(XDIFF_OBJS)
2191 $(VCSSVN_LIB): $(VCSSVN_OBJS)
2192 $(QUIET_AR)$(RM) $@ && $(AR) rcs $@ $(VCSSVN_OBJS)
2193
2194 +export DEFAULT_EDITOR DEFAULT_PAGER
2195 +
2196 doc:
2197 $(MAKE) -C Documentation all
2198