@matheusbsbs / matheus-bagliano / commits / 868da8d5e3
Fork 0

help.c: Add support for htmldir relative to git_exec_path()

If htmldir (in the Makefile) is a relative path, this path will now be interpreted relative to git_exec_path. This can be used to create an installation that can be moved to a different directory without re-compiling. The Windows installer (msysgit) is an example for such a setup. Note that the Makefile maps htmldir to the define GIT_HTML_PATH. Signed-off-by: Steffen Prohaska <prohaska@zib.de> Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Steffen Prohaska committed Jul 13, 2008 at 22:31 UTC 868da8d5e329c951f0d0cd049a8f9fecda64d388
1 file changed +5 -3
help.c
+5 -3
@@ -633,13 +633,15 @@ static void show_info_page(const char *git_cmd)
633 static void get_html_page_path(struct strbuf *page_path, const char *page)
634 {
635 struct stat st;
636 + const char *html_path = system_path(GIT_HTML_PATH);
637
638 /* Check that we have a git documentation directory. */
638 - if (stat(GIT_HTML_PATH "/git.html", &st) || !S_ISREG(st.st_mode))
639 - die("'%s': not a documentation directory.", GIT_HTML_PATH);
639 + if (stat(mkpath("%s/git.html", html_path), &st)
640 + || !S_ISREG(st.st_mode))
641 + die("'%s': not a documentation directory.", html_path);
642
643 strbuf_init(page_path, 0);
642 - strbuf_addf(page_path, GIT_HTML_PATH "/%s.html", page);
644 + strbuf_addf(page_path, "%s/%s.html", html_path, page);
645 }
646
647 static void show_html_page(const char *git_cmd)