git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 2/2] var doc: advertise current DEFAULT_PAGER and DEFAULT_EDITOR settings

From
Jonathan Nieder <jrnieder@gmail.com>
Date
Mar 31, 2012, 08:44 UTC
Message-ID
<20120331084453.GE4119@burratino>
In-Reply-To
<20120331084015.GC4119@burratino>

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>
---
Thanks for reading.
 Documentation/Makefile    |   10 ++++++++++
 Documentation/git-var.txt |   10 ++++++++++
 Makefile                  |    2 ++
 3 files changed, 22 insertions(+)
diff --git a/Documentation/Makefile b/Documentation/Makefile
index d40e211f..9fee0b92 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 beef9e28..44a5e356 100644
--- a/Documentation/git-var.txt
+++ b/Documentation/git-var.txt
@@ -44,14 +44,24 @@ GIT_EDITOR::
     --nofork`.  The order of preference is the `$GIT_EDITOR`
     environment variable, then `core.editor` configuration, then
     `$VISUAL`, then `$EDITOR`, and then the default chosen at compile
+ifndef::git-default-editor[]
     time, which is usually 'vi'.
+endif::git-default-editor[]
+ifdef::git-default-editor[]
+    time ('{git-default-editor}').
+endif::git-default-editor[]
 
 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 the default chosen at
+ifndef::git-default-pager[]
     compile time (usually 'less').
+endif::git-default-pager[]
+ifdef::git-default-pager[]
+    compile time ('{git-default-pager}').
+endif::git-default-pager[]
 
 Diagnostics
 -----------
diff --git a/Makefile b/Makefile
index be1957a5..adc48b0d 100644
--- a/Makefile
+++ b/Makefile
@@ -2258,6 +2258,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
 
-- 
1.7.10.rc3
Previous: Jonathan NiederNext: Junio C Hamano
Message 6 of 11 in “Re: [PATCH] Documentation: replace 'vi' for 'editor' to reflect build-time option”
  1. Jonathan NiederMar 30, 2012
  2. Junio C HamanoMar 30, 2012
  3. Bug#666250: [PATCH] Documentation: replace 'vi' for 'editor' to reflect build-time optionRodrigo Silva, Mar 30, 2012
  4. 0/2 Re: Documentation: replace 'vi' for 'editor' to reflect build-time optionJonathan Nieder, Mar 31, 2012
  5. 1/2 var doc: default editor and pager are configurable at build timeJonathan Nieder, Mar 31, 2012
  6. 2/2 var doc: advertise current DEFAULT_PAGER and DEFAULT_EDITOR settingsJonathan Nieder, Mar 31, 2012
  7. Junio C HamanoMar 31, 2012
  8. Jonathan NiederApr 18, 2012
  9. Phil HordMar 31, 2012
  10. Junio C HamanoMar 30, 2012
  11. Jonathan NiederMar 31, 2012

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.