Skip to content

Commit

Permalink
help.c: Add support for htmldir relative to git_exec_path()
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Johannes Sixt <[email protected]>
Signed-off-by: Junio C Hamano <[email protected]>
  • Loading branch information
sprohaska authored and gitster committed Jul 13, 2008
1 parent 2de9de5 commit 868da8d
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions help.c
Original file line number Diff line number Diff line change
Expand Up @@ -633,13 +633,15 @@ 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);

/* 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);
if (stat(mkpath("%s/git.html", html_path), &st)
|| !S_ISREG(st.st_mode))
die("'%s': not a documentation directory.", html_path);

strbuf_init(page_path, 0);
strbuf_addf(page_path, GIT_HTML_PATH "/%s.html", page);
strbuf_addf(page_path, "%s/%s.html", html_path, page);
}

static void show_html_page(const char *git_cmd)
Expand Down

0 comments on commit 868da8d

Please sign in to comment.