builtin-help: fallback to GIT_MAN_VIEWER before man
In some situations it is useful to be able to switch viewers via the environment, e.g. in Emacs shell buffers. So check the GIT_MAN_VIEWER environment variable and try it before falling back to "man". Signed-off-by: Romain Francoise <romain@orebokech.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Romain Francoise committed
Aug 29, 2008 at 17:00 UTC
5059a427804f9fefaf75dd1aa92cb620ce9219c7
2 files changed
+6
-1
Documentation/git-help.txt
+3
-1
@@ -112,7 +112,9 @@ For example, this configuration:
112
will try to use konqueror first. But this may fail (for example if
113
DISPLAY is not set) and in that case emacs' woman mode will be tried.
114
115
-If everything fails the 'man' program will be tried anyway.
115
+If everything fails, or if no viewer is configured, the viewer specified
116
+in the GIT_MAN_VIEWER environment variable will be tried. If that
117
+fails too, the 'man' program will be tried anyway.
118
119
man.<tool>.path
120
~~~~~~~~~~~~~~~
builtin-help.c
+3
@@ -361,12 +361,15 @@ static void show_man_page(const char *git_cmd)
361
{
362
struct man_viewer_list *viewer;
363
const char *page = cmd_to_page(git_cmd);
364
+ const char *fallback = getenv("GIT_MAN_VIEWER");
365
366
setup_man_path();
367
for (viewer = man_viewer_list; viewer; viewer = viewer->next)
368
{
369
exec_viewer(viewer->name, page); /* will return when unable */
370
}
371
+ if (fallback)
372
+ exec_viewer(fallback, page);
373
exec_viewer("man", page);
374
die("no man viewer handled the request");
375
}