From mboxrd@z Thu Jan 1 00:00:00 1970 From: Chris Webb Subject: [PATCH 1/3] Add config variable to set HTML path for git-help --web Date: Wed, 27 Jun 2012 21:55:12 +0100 Message-ID: <8d3c71d21710c66e4d5560cec958552b69a22338.1340830514.git.chris@arachsys.com> References: <20120627205459.GC11498@arachsys.com> Cc: chris@arachsys.com To: git@vger.kernel.org X-From: git-owner@vger.kernel.org Wed Jun 27 22:55:35 2012 Return-path: Envelope-to: gcvg-git-2@plane.gmane.org Received: from vger.kernel.org ([209.132.180.67]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1SjzGq-0002rq-Pe for gcvg-git-2@plane.gmane.org; Wed, 27 Jun 2012 22:55:29 +0200 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756883Ab2F0UzX (ORCPT ); Wed, 27 Jun 2012 16:55:23 -0400 Received: from alpha.arachsys.com ([91.203.57.7]:43622 "EHLO alpha.arachsys.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756761Ab2F0UzV (ORCPT ); Wed, 27 Jun 2012 16:55:21 -0400 Received: from [81.2.114.212] (helo=miranda.home.) by alpha.arachsys.com with esmtpa (Exim 4.72) (envelope-from ) id 1SjzGi-0002NM-8v; Wed, 27 Jun 2012 21:55:20 +0100 X-Mailer: git-send-email 1.7.10 In-Reply-To: <20120627205459.GC11498@arachsys.com> Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Archived-At: 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 --- builtin/help.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/builtin/help.c b/builtin/help.c index 8f9cd60..b467db2 100644 --- a/builtin/help.c +++ b/builtin/help.c @@ -34,6 +34,8 @@ enum help_format { HELP_FORMAT_WEB }; +static char *html_path = NULL; + 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,7 +395,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) -- 1.7.10