1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-11-01 14:57:52 +01:00
git/t/t0012-help.sh
Ralf Thielow 2c6b6d9f7d help: make option --help open man pages only for Git commands
If option --help is passed to a Git command, we try to open
the man page of that command.  However, we do it for both commands
and concepts.  Make sure it is an actual command.

This makes "git <concept> --help" not working anymore, while
"git help <concept>" still works.

Signed-off-by: Ralf Thielow <ralf.thielow@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-08-30 16:09:41 -07:00

52 lines
1.3 KiB
Bash
Executable file

#!/bin/sh
test_description='help'
. ./test-lib.sh
configure_help () {
test_config help.format html &&
# Unless the path has "://" in it, Git tries to make sure
# the documentation directory locally exists. Avoid it as
# we are only interested in seeing an attempt to correctly
# invoke a help browser in this test.
test_config help.htmlpath test://html &&
# Name a custom browser
test_config browser.test.cmd ./test-browser &&
test_config help.browser test
}
test_expect_success "setup" '
# Just write out which page gets requested
write_script test-browser <<-\EOF
echo "$*" >test-browser.log
EOF
'
test_expect_success "works for commands and guides by default" '
configure_help &&
git help status &&
echo "test://html/git-status.html" >expect &&
test_cmp expect test-browser.log &&
git help revisions &&
echo "test://html/gitrevisions.html" >expect &&
test_cmp expect test-browser.log
'
test_expect_success "--exclude-guides does not work for guides" '
>test-browser.log &&
test_must_fail git help --exclude-guides revisions &&
test_must_be_empty test-browser.log
'
test_expect_success "--help does not work for guides" "
cat <<-EOF >expect &&
git: 'revisions' is not a git command. See 'git --help'.
EOF
test_must_fail git revisions --help 2>actual &&
test_i18ncmp expect actual
"
test_done