From: Manuel Boni <ziosombrero@xxxxxxxxx> 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@xxxxxxxxx> Signed-off-by: Manuel Boni <ziosombrero@xxxxxxxxx> --- config.txt: add completion for include, includeIf CC: Ævar Arnfjörð Bjarmason avarab@xxxxxxxxx cc: Jeff King peff@xxxxxxxx Update 2022-07-16: I addressed the suggestions by Jeff King and Junio C. Hamano by integrating their fixes and by rewording the commit message, so that emphasis is put on the documentation enhancement and mentioning the improved tab completion as a beneficial side effect. Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-1285%2Fziosombrero%2Fcomp-config-include-v2 Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-1285/ziosombrero/comp-config-include-v2 Pull-Request: https://github.com/gitgitgadget/git/pull/1285 Range-diff vs v1: 1: 79d877bcd6c ! 1: 38b1860020f config.txt: add completion for include, includeIf @@ Metadata Author: Manuel Boni <ziosombrero@xxxxxxxxx> ## Commit message ## - config.txt: add completion for include, includeIf + 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 tab completion support for the aforementioned items, - along with two new tests, based on the existing ones, - specifically for this completion. Variable completion only works - for "include" for now. + 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@xxxxxxxxx> Signed-off-by: Manuel Boni <ziosombrero@xxxxxxxxx> - Based-on-patch-by: Ævar Arnfjörð Bjarmason <avarab@xxxxxxxxx> + + ## Documentation/config.txt ## +@@ Documentation/config.txt: include::config/i18n.txt[] + + include::config/imap.txt[] + ++include::config/includeif.txt[] ++ + include::config/index.txt[] + + include::config/init.txt[] ## Documentation/config/includeif.txt (new) ## @@ +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. ++ linkgit:git-config[1] documentation, ++ specifically the "Includes" and "Conditional Includes" subsections. ++ ## t/t9902-completion.sh ## @@ t/t9902-completion.sh: test_expect_success 'git config - section' ' Documentation/config.txt | 2 ++ Documentation/config/includeif.txt | 7 +++++++ t/t9902-completion.sh | 13 +++++++++++++ 3 files changed, 22 insertions(+) create mode 100644 Documentation/config/includeif.txt diff --git a/Documentation/config.txt b/Documentation/config.txt index e376d547ce0..5b5b9765699 100644 --- a/Documentation/config.txt +++ b/Documentation/config.txt @@ -445,6 +445,8 @@ include::config/i18n.txt[] include::config/imap.txt[] +include::config/includeif.txt[] + include::config/index.txt[] include::config/init.txt[] diff --git a/Documentation/config/includeif.txt b/Documentation/config/includeif.txt new file mode 100644 index 00000000000..28b6a52d9f5 --- /dev/null +++ b/Documentation/config/includeif.txt @@ -0,0 +1,7 @@ +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. + diff --git a/t/t9902-completion.sh b/t/t9902-completion.sh index 31526e6b641..43de868b800 100755 --- a/t/t9902-completion.sh +++ b/t/t9902-completion.sh @@ -2485,6 +2485,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 @@ -2493,6 +2500,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 base-commit: 9dd64cb4d310986dd7b8ca7fff92f9b61e0bd21a -- gitgitgadget