From 57bab054a9f7cd82f8889ef4fad58653d89f38fc Mon Sep 17 00:00:00 2001 From: Steffen Prohaska Date: Sat, 11 Aug 2007 22:15:39 +0200 Subject: [PATCH] help (msysgit): teach git help to open html from /doc/git/html/ Html pages will be opened using the default Windows application configured for html. This code path is taken for msysgit (mingw). It is assumed that html pages are installed at /doc/git/html. This needs to be ensured by the msysgit superproject to make this patch useful. html pages should be cloned from git.git's main repo. This is the easiest way to get up-to-date documentation, without requiring the complete tool chain to generate them locally. If html pages are not yet there, you can use the following commands to get them: mkdir -p /doc/git/html cd /doc/git/html/ git init git config remote.origin.url git://git.kernel.org/pub/scm/git/git.git git config remote.origin.fetch refs/heads/html:refs/remotes/origin/html git fetch git checkout --track -b html origin/html and update the html documentation with git pull Signed-off-by: Steffen Prohaska --- help.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/help.c b/help.c index 7d59efa50b..e7da8ae430 100644 --- a/help.c +++ b/help.c @@ -180,7 +180,25 @@ static void show_man_page(const char *git_cmd) page = p; } +#ifdef __MINGW32__ + { + char* prefix = "/doc/git/html/"; + int prefix_len = strlen (prefix); + char* suffix = ".html"; + int suffix_len = strlen (suffix); + int page_len = strlen (page); + int htmlpath_len = prefix_len + page_len + suffix_len; + char* htmlpath = xmalloc (htmlpath_len + 1); + strcpy (htmlpath, prefix); + strcpy (htmlpath + prefix_len, page); + strcpy (htmlpath + prefix_len + page_len, suffix); + htmlpath[htmlpath_len] = 0; + /* We need sh here to run shell script /bin/start. */ + execlp("sh", "start", "/bin/start", htmlpath, NULL ); + } +#else execlp("man", "man", page, NULL); +#endif } void help_unknown_cmd(const char *cmd)