Merge branch 'jc/doc-git-updates' into maint
[gitweb.git] / builtin / help.c
index 9e36fb4cc708e12e1fc60903239f3b5967835954..efea4f55e173a5ff2d7e1748316d6a94266e915a 100644 (file)
 #include "column.h"
 #include "help.h"
 
+#ifndef DEFAULT_HELP_FORMAT
+#define DEFAULT_HELP_FORMAT "man"
+#endif
+
 static struct man_viewer_list {
        struct man_viewer_list *next;
        char name[FLEX_ARRAY];
@@ -395,9 +399,11 @@ static void get_html_page_path(struct strbuf *page_path, const char *page)
                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);
@@ -456,6 +462,8 @@ int cmd_help(int argc, const char **argv, const char *prefix)
 
        if (parsed_help_format != HELP_FORMAT_NONE)
                help_format = parsed_help_format;
+       if (help_format == HELP_FORMAT_NONE)
+               help_format = parse_help_format(DEFAULT_HELP_FORMAT);
 
        alias = alias_lookup(argv[0]);
        if (alias && !is_git_command(argv[0])) {