Merge branch 'ma/help-w-check-for-requested-page'
The error in "git help no-such-git-command" is handled better. * ma/help-w-check-for-requested-page: help: make sure local html page exists before calling external processesmaint
commit
bd42622e5f
|
|
@ -467,11 +467,14 @@ static void get_html_page_path(struct strbuf *page_path, const char *page)
|
||||||
if (!html_path)
|
if (!html_path)
|
||||||
html_path = to_free = system_path(GIT_HTML_PATH);
|
html_path = to_free = system_path(GIT_HTML_PATH);
|
||||||
|
|
||||||
/* Check that we have a git documentation directory. */
|
/*
|
||||||
|
* Check that the page we're looking for exists.
|
||||||
|
*/
|
||||||
if (!strstr(html_path, "://")) {
|
if (!strstr(html_path, "://")) {
|
||||||
if (stat(mkpath("%s/git.html", html_path), &st)
|
if (stat(mkpath("%s/%s.html", html_path, page), &st)
|
||||||
|| !S_ISREG(st.st_mode))
|
|| !S_ISREG(st.st_mode))
|
||||||
die("'%s': not a documentation directory.", html_path);
|
die("'%s/%s.html': documentation file not found.",
|
||||||
|
html_path, page);
|
||||||
}
|
}
|
||||||
|
|
||||||
strbuf_init(page_path, 0);
|
strbuf_init(page_path, 0);
|
||||||
|
|
|
||||||
|
|
@ -73,6 +73,22 @@ test_expect_success 'git help -g' '
|
||||||
test_i18ngrep "^ tutorial " help.output
|
test_i18ngrep "^ tutorial " help.output
|
||||||
'
|
'
|
||||||
|
|
||||||
|
test_expect_success 'git help fails for non-existing html pages' '
|
||||||
|
configure_help &&
|
||||||
|
mkdir html-empty &&
|
||||||
|
test_must_fail git -c help.htmlpath=html-empty help status &&
|
||||||
|
test_must_be_empty test-browser.log
|
||||||
|
'
|
||||||
|
|
||||||
|
test_expect_success 'git help succeeds without git.html' '
|
||||||
|
configure_help &&
|
||||||
|
mkdir html-with-docs &&
|
||||||
|
touch html-with-docs/git-status.html &&
|
||||||
|
git -c help.htmlpath=html-with-docs help status &&
|
||||||
|
echo "html-with-docs/git-status.html" >expect &&
|
||||||
|
test_cmp expect test-browser.log
|
||||||
|
'
|
||||||
|
|
||||||
test_expect_success 'generate builtin list' '
|
test_expect_success 'generate builtin list' '
|
||||||
git --list-cmds=builtins >builtins
|
git --list-cmds=builtins >builtins
|
||||||
'
|
'
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue