Skip to content

Commit f697a27

Browse files
committed
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
2 parents 69833ba + 86272b4 commit f697a27

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

builtin/help.c

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ enum help_format {
3434
HELP_FORMAT_WEB
3535
};
3636

37+
static const char *html_path;
38+
3739
static int show_all = 0;
3840
static unsigned int colopts;
3941
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)
265267
help_format = parse_help_format(value);
266268
return 0;
267269
}
270+
if (!strcmp(var, "help.htmlpath")) {
271+
if (!value)
272+
return config_error_nonbool(var);
273+
html_path = xstrdup(value);
274+
return 0;
275+
}
268276
if (!strcmp(var, "man.viewer")) {
269277
if (!value)
270278
return config_error_nonbool(var);
@@ -387,12 +395,15 @@ static void show_info_page(const char *git_cmd)
387395
static void get_html_page_path(struct strbuf *page_path, const char *page)
388396
{
389397
struct stat st;
390-
const char *html_path = system_path(GIT_HTML_PATH);
398+
if (!html_path)
399+
html_path = system_path(GIT_HTML_PATH);
391400

392401
/* Check that we have a git documentation directory. */
393-
if (stat(mkpath("%s/git.html", html_path), &st)
394-
|| !S_ISREG(st.st_mode))
395-
die(_("'%s': not a documentation directory."), html_path);
402+
if (!strstr(html_path, "://")) {
403+
if (stat(mkpath("%s/git.html", html_path), &st)
404+
|| !S_ISREG(st.st_mode))
405+
die("'%s': not a documentation directory.", html_path);
406+
}
396407

397408
strbuf_init(page_path, 0);
398409
strbuf_addf(page_path, "%s/%s.html", html_path, page);

0 commit comments

Comments
 (0)