Skip to content

Commit 07aed58

Browse files
Manuel Bonigitster
authored andcommitted
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 <[email protected]> Signed-off-by: Manuel Boni <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 359da65 commit 07aed58

File tree

3 files changed

+21
-0
lines changed

3 files changed

+21
-0
lines changed

Documentation/config.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -410,6 +410,8 @@ include::config/i18n.txt[]
410410

411411
include::config/imap.txt[]
412412

413+
include::config/includeif.txt[]
414+
413415
include::config/index.txt[]
414416

415417
include::config/init.txt[]

Documentation/config/includeif.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2330,6 +2330,13 @@ test_expect_success 'git config - section' '
23302330
EOF
23312331
'
23322332

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+
23332340
test_expect_success 'git config - variable name' '
23342341
test_completion "git config log.d" <<-\EOF
23352342
log.date Z
@@ -2338,6 +2345,12 @@ test_expect_success 'git config - variable name' '
23382345
EOF
23392346
'
23402347

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+
23412354
test_expect_success 'git config - value' '
23422355
test_completion "git config color.pager " <<-\EOF
23432356
false Z

0 commit comments

Comments
 (0)