Skip to content

Commit

Permalink
config.txt: document include, includeIf
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
Manuel Boni authored and gitster committed Jul 17, 2022
1 parent 359da65 commit 07aed58
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Documentation/config.txt
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,8 @@ include::config/i18n.txt[]

include::config/imap.txt[]

include::config/includeif.txt[]

include::config/index.txt[]

include::config/init.txt[]
Expand Down
6 changes: 6 additions & 0 deletions Documentation/config/includeif.txt
Original file line number Diff line number Diff line change
@@ -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.
13 changes: 13 additions & 0 deletions t/t9902-completion.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 07aed58

Please sign in to comment.