Skip to content

Commit 868da8d

Browse files
sprohaskagitster
authored andcommitted
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>
1 parent 2de9de5 commit 868da8d

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

help.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -633,13 +633,15 @@ static void show_info_page(const char *git_cmd)
633633
static void get_html_page_path(struct strbuf *page_path, const char *page)
634634
{
635635
struct stat st;
636+
const char *html_path = system_path(GIT_HTML_PATH);
636637

637638
/* 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);
640642

641643
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);
643645
}
644646

645647
static void show_html_page(const char *git_cmd)

0 commit comments

Comments
 (0)