summaryrefslogtreecommitdiff
path: root/builtin-help.c
diff options
context:
space:
mode:
authorLibravatar Romain Francoise <romain@orebokech.com>2008-08-29 17:00:43 +0200
committerLibravatar Junio C Hamano <gitster@pobox.com>2008-08-29 21:46:33 -0700
commit5059a427804f9fefaf75dd1aa92cb620ce9219c7 (patch)
treeb1719659fd78857880c0b2d4f1a4824c20b15084 /builtin-help.c
parentMerge branch 'maint' (diff)
downloadtgif-5059a427804f9fefaf75dd1aa92cb620ce9219c7.tar.xz
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>
Diffstat (limited to 'builtin-help.c')
-rw-r--r--builtin-help.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/builtin-help.c b/builtin-help.c
index 721038e4f5..64207cbfe9 100644
--- a/builtin-help.c
+++ b/builtin-help.c
@@ -361,12 +361,15 @@ static void show_man_page(const char *git_cmd)
{
struct man_viewer_list *viewer;
const char *page = cmd_to_page(git_cmd);
+ const char *fallback = getenv("GIT_MAN_VIEWER");
setup_man_path();
for (viewer = man_viewer_list; viewer; viewer = viewer->next)
{
exec_viewer(viewer->name, page); /* will return when unable */
}
+ if (fallback)
+ exec_viewer(fallback, page);
exec_viewer("man", page);
die("no man viewer handled the request");
}