]> git.ipfire.org Git - thirdparty/git.git/commitdiff
Add config variable to set HTML path for git-help --web
authorChris Webb <chris@arachsys.com>
Thu, 28 Jun 2012 06:58:02 +0000 (07:58 +0100)
committerJunio C Hamano <gitster@pobox.com>
Thu, 28 Jun 2012 21:37:26 +0000 (14:37 -0700)
If set in git-config, help.htmlpath overrides system_path(GIT_HTML_PATH)
which was compiled in. This allows users to repoint system-wide git at
their own copy of the documentation without recompiling.

Signed-off-by: Chris Webb <chris@arachsys.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/help.c

index 43d3c84449a57ec7028acb663d4ab4bea134c97e..9e36fb4cc708e12e1fc60903239f3b5967835954 100644 (file)
@@ -30,6 +30,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;
@@ -261,6 +263,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);
@@ -383,7 +391,8 @@ 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)