Merge branch 'db/push-single-with-HEAD'
[gitweb.git] / help.c
diff --git a/help.c b/help.c
index 1302a61c83c524099e7d39257daa273a09edad4f..8143dcdd38218ef03c47535c7c2e761cf1a868ce 100644 (file)
--- a/help.c
+++ b/help.c
@@ -39,10 +39,8 @@ static void parse_help_format(const char *format)
 
 static int git_help_config(const char *var, const char *value)
 {
-       if (!strcmp(var, "help.format")) {
-               help_default_format = xstrdup(value);
-               return 0;
-       }
+       if (!strcmp(var, "help.format"))
+               return git_config_string(&help_default_format, var, value);
        return git_default_config(var, value);
 }
 
@@ -328,10 +326,26 @@ static void show_info_page(const char *git_cmd)
        execlp("info", "info", "gitman", page, NULL);
 }
 
+static void get_html_page_path(struct strbuf *page_path, const char *page)
+{
+       struct stat st;
+
+       /* Check that we have a git documentation directory. */
+       if (stat(GIT_HTML_PATH "/git.html", &st) || !S_ISREG(st.st_mode))
+               die("'%s': not a documentation directory.", GIT_HTML_PATH);
+
+       strbuf_init(page_path, 0);
+       strbuf_addf(page_path, GIT_HTML_PATH "/%s.html", page);
+}
+
 static void show_html_page(const char *git_cmd)
 {
        const char *page = cmd_to_page(git_cmd);
-       execl_git_cmd("help--browse", page, NULL);
+       struct strbuf page_path; /* it leaks but we exec bellow */
+
+       get_html_page_path(&page_path, page);
+
+       execl_git_cmd("web--browse", "-c", "help.browser", page_path.buf, NULL);
 }
 
 void help_unknown_cmd(const char *cmd)