diff options
author | Junio C Hamano <gitster@pobox.com> | 2012-07-09 09:02:19 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2012-07-09 09:02:19 -0700 |
commit | f697a27aa6ecb2c8db7679ec5d403cf3b69f6afb (patch) | |
tree | 1fa431af2c1d0ab136115f930ebf06441a8e53a8 /builtin | |
parent | Merge branch 'mz/empty-rebase-test' (diff) | |
parent | Allow help.htmlpath to be a URL prefix (diff) | |
download | tgif-f697a27aa6ecb2c8db7679ec5d403cf3b69f6afb.tar.xz |
Merge branch 'cw/help-over-network'
"git help -w $cmd" can show HTML version of documentation for
"git-$cmd" by setting help.htmlpath to somewhere other than the
default location where the build procedure installs them locally;
the variable can even point at a http:// URL.
* cw/help-over-network:
Allow help.htmlpath to be a URL prefix
Add config variable to set HTML path for git-help --web
Diffstat (limited to 'builtin')
-rw-r--r-- | builtin/help.c | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/builtin/help.c b/builtin/help.c index 8f9cd60548..efea4f55e1 100644 --- a/builtin/help.c +++ b/builtin/help.c @@ -34,6 +34,8 @@ enum help_format { HELP_FORMAT_WEB }; +static const char *html_path; + static int show_all = 0; static unsigned int colopts; static enum help_format help_format = HELP_FORMAT_NONE; @@ -265,6 +267,12 @@ static int git_help_config(const char *var, const char *value, void *cb) help_format = parse_help_format(value); return 0; } + if (!strcmp(var, "help.htmlpath")) { + if (!value) + return config_error_nonbool(var); + html_path = xstrdup(value); + return 0; + } if (!strcmp(var, "man.viewer")) { if (!value) return config_error_nonbool(var); @@ -387,12 +395,15 @@ static void show_info_page(const char *git_cmd) static void get_html_page_path(struct strbuf *page_path, const char *page) { struct stat st; - const char *html_path = system_path(GIT_HTML_PATH); + if (!html_path) + html_path = system_path(GIT_HTML_PATH); /* Check that we have a git documentation directory. */ - if (stat(mkpath("%s/git.html", html_path), &st) - || !S_ISREG(st.st_mode)) - die(_("'%s': not a documentation directory."), html_path); + if (!strstr(html_path, "://")) { + if (stat(mkpath("%s/git.html", html_path), &st) + || !S_ISREG(st.st_mode)) + die("'%s': not a documentation directory.", html_path); + } strbuf_init(page_path, 0); strbuf_addf(page_path, "%s/%s.html", html_path, page); |