From 4e0ce4dfea869cfe383149a3db5a430f0579c3f4 Mon Sep 17 00:00:00 2001 From: Jonathan Nieder Date: Sat, 31 Mar 2012 03:42:34 -0500 Subject: var doc: default editor and pager are configurable at build time Some distributors customize the fallback pager and editor used by git commands when the user has not indicated a preference via the core.editor/core.pager configuration or GIT_EDITOR, GIT_PAGER, VISUAL, EDITOR, and PAGER environment variables, and git's build system provides DEFAULT_PAGER and DEFAULT_EDITOR makefile settings to help them with that (see v1.6.6-rc0~24, 2009-11-20). Unfortunately those compile-time settings do not affect the documentation, so the uninitiated user who tries to understand git by reading the git-var(1) manpage can easily be confused when git falls back to 'nano' and 'more' instead of 'vi' and 'less'. Even if the distributor patches the distributed docs to reflect the new default, the user may read the official documentation from the git-htmldocs repository online and be confused in the same way. Add a few words stating that the defaults are customizable at compile time to make the behavior crystal clear. Reported-by: Rodrigo Silva (MestreLion) Signed-off-by: Jonathan Nieder Signed-off-by: Junio C Hamano --- Documentation/git-var.txt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Documentation/git-var.txt b/Documentation/git-var.txt index 5317cc2474..beef9e285d 100644 --- a/Documentation/git-var.txt +++ b/Documentation/git-var.txt @@ -43,13 +43,15 @@ GIT_EDITOR:: `$SOME_ENVIRONMENT_VARIABLE`, `"C:\Program Files\Vim\gvim.exe" --nofork`. The order of preference is the `$GIT_EDITOR` environment variable, then `core.editor` configuration, then - `$VISUAL`, then `$EDITOR`, and then finally 'vi'. + `$VISUAL`, then `$EDITOR`, and then the default chosen at compile + time, which is usually 'vi'. GIT_PAGER:: Text viewer for use by git commands (e.g., 'less'). The value is meant to be interpreted by the shell. The order of preference is the `$GIT_PAGER` environment variable, then `core.pager` - configuration, then `$PAGER`, and then finally 'less'. + configuration, then `$PAGER`, and then the default chosen at + compile time (usually 'less'). Diagnostics ----------- -- cgit v1.2.3 From 5b58619aa011c2047e7b67ca28630d8a2e72ca1f Mon Sep 17 00:00:00 2001 From: Jonathan Nieder Date: Sat, 31 Mar 2012 03:44:53 -0500 Subject: 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 Signed-off-by: Jonathan Nieder Signed-off-by: Junio C Hamano --- Documentation/Makefile | 10 ++++++++++ Documentation/git-var.txt | 6 ++++++ Makefile | 2 ++ 3 files changed, 18 insertions(+) diff --git a/Documentation/Makefile b/Documentation/Makefile index d40e211f22..9fee0b9261 100644 --- a/Documentation/Makefile +++ b/Documentation/Makefile @@ -124,6 +124,16 @@ SHELL_PATH ?= $(SHELL) # Shell quote; SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH)) +ifdef DEFAULT_PAGER +DEFAULT_PAGER_SQ = $(subst ','\'',$(DEFAULT_PAGER)) +ASCIIDOC_EXTRA += -a 'git-default-pager=$(DEFAULT_PAGER_SQ)' +endif + +ifdef DEFAULT_EDITOR +DEFAULT_EDITOR_SQ = $(subst ','\'',$(DEFAULT_EDITOR)) +ASCIIDOC_EXTRA += -a 'git-default-editor=$(DEFAULT_EDITOR_SQ)' +endif + # # Please note that there is a minor bug in asciidoc. # The version after 6.0.3 _will_ include the patch found here: diff --git a/Documentation/git-var.txt b/Documentation/git-var.txt index beef9e285d..988a3234f4 100644 --- a/Documentation/git-var.txt +++ b/Documentation/git-var.txt @@ -45,6 +45,9 @@ GIT_EDITOR:: environment variable, then `core.editor` configuration, then `$VISUAL`, then `$EDITOR`, and then the default chosen at compile time, which is usually 'vi'. +ifdef::git-default-editor[] + The build you are using chose '{git-default-editor}' as the default. +endif::git-default-editor[] GIT_PAGER:: Text viewer for use by git commands (e.g., 'less'). The value @@ -52,6 +55,9 @@ GIT_PAGER:: is the `$GIT_PAGER` environment variable, then `core.pager` configuration, then `$PAGER`, and then the default chosen at compile time (usually 'less'). +ifdef::git-default-pager[] + The build you are using chose '{git-default-pager}' as the default. +endif::git-default-pager[] Diagnostics ----------- diff --git a/Makefile b/Makefile index a782409306..394ac08546 100644 --- a/Makefile +++ b/Makefile @@ -2191,6 +2191,8 @@ $(XDIFF_LIB): $(XDIFF_OBJS) $(VCSSVN_LIB): $(VCSSVN_OBJS) $(QUIET_AR)$(RM) $@ && $(AR) rcs $@ $(VCSSVN_OBJS) +export DEFAULT_EDITOR DEFAULT_PAGER + doc: $(MAKE) -C Documentation all -- cgit v1.2.3