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 <prohaska@zib.de>
This commit is contained in:
Steffen Prohaska
2007-08-11 22:15:39 +02:00
committed by Dmitry Kakurin
parent 89697a4c15
commit 57bab054a9

18
help.c
View File

@@ -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)