config.txt: document include, includeIf

Git config's tab completion does not yet know about the "include"
and "includeIf" sections, nor the related "path" variable.

Add a description for these two sections in
'Documentation/config/includeif.txt', which points to git-config's
documentation, specifically the "Includes" and "Conditional Includes"
subsections.

As a side effect, tab completion can successfully complete the
'include', 'includeIf', and 'include.add' expressions.
This effect is tested by two new ad-hoc tests.
Variable completion only works for "include" for now.

Credit for the ideas behind this patch goes to
Ævar Arnfjörð Bjarmason.

Helped-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Manuel Boni <ziosombrero@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Manuel Boni 2022-07-16 20:13:43 +00:00 committed by Junio C Hamano
parent 359da658ae
commit 07aed58017
3 changed files with 21 additions and 0 deletions

View File

@ -410,6 +410,8 @@ include::config/i18n.txt[]
include::config/imap.txt[]
include::config/includeif.txt[]
include::config/index.txt[]
include::config/init.txt[]

View File

@ -0,0 +1,6 @@
include.path::
includeIf.<condition>.path::
Special variables to include other configuration files. See
the "CONFIGURATION FILE" section in the main
linkgit:git-config[1] documentation,
specifically the "Includes" and "Conditional Includes" subsections.

View File

@ -2330,6 +2330,13 @@ test_expect_success 'git config - section' '
EOF
'
test_expect_success 'git config - section include, includeIf' '
test_completion "git config inclu" <<-\EOF
include.Z
includeIf.Z
EOF
'
test_expect_success 'git config - variable name' '
test_completion "git config log.d" <<-\EOF
log.date Z
@ -2338,6 +2345,12 @@ test_expect_success 'git config - variable name' '
EOF
'
test_expect_success 'git config - variable name include' '
test_completion "git config include.p" <<-\EOF
include.path Z
EOF
'
test_expect_success 'git config - value' '
test_completion "git config color.pager " <<-\EOF
false Z