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>

Manuel Boni committed Jul 16, 2022 at 20:13 UTC 07aed5801722635684b5f0f8f3c26903fdd11f8e
3 files changed +21
Documentation/config.txt
+2
@@ -410,6 +410,8 @@ include::config/i18n.txt[]
410
411 include::config/imap.txt[]
412
413 +include::config/includeif.txt[]
414 +
415 include::config/index.txt[]
416
417 include::config/init.txt[]
Documentation/config/includeif.txt new
+6
@@ -0,0 +1,6 @@
1 +include.path::
2 +includeIf.<condition>.path::
3 + Special variables to include other configuration files. See
4 + the "CONFIGURATION FILE" section in the main
5 + linkgit:git-config[1] documentation,
6 + specifically the "Includes" and "Conditional Includes" subsections.
t/t9902-completion.sh
+13
@@ -2330,6 +2330,13 @@ test_expect_success 'git config - section' '
2330 EOF
2331 '
2332
2333 +test_expect_success 'git config - section include, includeIf' '
2334 + test_completion "git config inclu" <<-\EOF
2335 + include.Z
2336 + includeIf.Z
2337 + EOF
2338 +'
2339 +
2340 test_expect_success 'git config - variable name' '
2341 test_completion "git config log.d" <<-\EOF
2342 log.date Z
@@ -2338,6 +2345,12 @@ test_expect_success 'git config - variable name' '
2345 EOF
2346 '
2347
2348 +test_expect_success 'git config - variable name include' '
2349 + test_completion "git config include.p" <<-\EOF
2350 + include.path Z
2351 + EOF
2352 +'
2353 +
2354 test_expect_success 'git config - value' '
2355 test_completion "git config color.pager " <<-\EOF
2356 false Z