Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRalf Thielow <ralf.thielow@gmail.com>2016-08-26 20:58:35 +0300
committerJunio C Hamano <gitster@pobox.com>2016-08-31 02:09:41 +0300
commitaf74128f4a447678daae4d59069fba8a0c797210 (patch)
treea8f206722cb28b37b19b30bed506cb0acbf686ea /t/t0012-help.sh
parent3b1c6a9b6ef3a1b26f24439436a09482a3618ff3 (diff)
help: introduce option --exclude-guides
Introduce option --exclude-guides to the help command. With this option being passed, "git help" will open man pages only for actual commands. Since we know it is a command, we can use function help_unknown_command to give the user advice on typos. Helped-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Ralf Thielow <ralf.thielow@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t0012-help.sh')
-rwxr-xr-xt/t0012-help.sh44
1 files changed, 44 insertions, 0 deletions
diff --git a/t/t0012-help.sh b/t/t0012-help.sh
new file mode 100755
index 0000000000..920a663c3e
--- /dev/null
+++ b/t/t0012-help.sh
@@ -0,0 +1,44 @@
+#!/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_done