Git fork

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 processes

+22 -3
+6 -3
builtin/help.c
··· 467 467 if (!html_path) 468 468 html_path = to_free = system_path(GIT_HTML_PATH); 469 469 470 - /* Check that we have a git documentation directory. */ 470 + /* 471 + * Check that the page we're looking for exists. 472 + */ 471 473 if (!strstr(html_path, "://")) { 472 - if (stat(mkpath("%s/git.html", html_path), &st) 474 + if (stat(mkpath("%s/%s.html", html_path, page), &st) 473 475 || !S_ISREG(st.st_mode)) 474 - die("'%s': not a documentation directory.", html_path); 476 + die("'%s/%s.html': documentation file not found.", 477 + html_path, page); 475 478 } 476 479 477 480 strbuf_init(page_path, 0);
+16
t/t0012-help.sh
··· 73 73 test_i18ngrep "^ tutorial " help.output 74 74 ' 75 75 76 + test_expect_success 'git help fails for non-existing html pages' ' 77 + configure_help && 78 + mkdir html-empty && 79 + test_must_fail git -c help.htmlpath=html-empty help status && 80 + test_must_be_empty test-browser.log 81 + ' 82 + 83 + test_expect_success 'git help succeeds without git.html' ' 84 + configure_help && 85 + mkdir html-with-docs && 86 + touch html-with-docs/git-status.html && 87 + git -c help.htmlpath=html-with-docs help status && 88 + echo "html-with-docs/git-status.html" >expect && 89 + test_cmp expect test-browser.log 90 + ' 91 + 76 92 test_expect_success 'generate builtin list' ' 77 93 git --list-cmds=builtins >builtins 78 94 '