From: "Manuel Boni via GitGitGadget" <gitgitgadget@gmail.com>
To: git@vger.kernel.org
Cc: Manuel Boni <ziosombrero@gmail.com>, Manuel Boni <ziosombrero@gmail.com>
Subject: [PATCH v2] config.txt: document include, includeIf
Date: Sat, 16 Jul 2022 20:13:43 +0000 [thread overview]
Message-ID: <pull.1285.v2.git.1658002423864.gitgitgadget@gmail.com> (raw)
In-Reply-To: <pull.1285.git.1657738937049.gitgitgadget@gmail.com>
From: Manuel Boni <ziosombrero@gmail.com>
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>
---
config.txt: add completion for include, includeIf
CC: Ævar Arnfjörð Bjarmason avarab@gmail.com cc: Jeff King peff@peff.net
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@gmail.com>
## 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@gmail.com>
Signed-off-by: Manuel Boni <ziosombrero@gmail.com>
- Based-on-patch-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
+
+ ## 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
next prev parent reply other threads:[~2022-07-16 20:13 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-13 19:02 [PATCH] config.txt: add completion for include, includeIf Manuel Boni via GitGitGadget
2022-07-13 19:32 ` Jeff King
[not found] ` <d21115d5-8bae-c120-453f-9dbb600d0431@gmail.com>
2022-07-14 21:13 ` Jeff King
2022-07-13 19:52 ` Junio C Hamano
2022-07-16 20:13 ` Manuel Boni via GitGitGadget [this message]
2022-07-16 22:49 ` [PATCH v2] config.txt: document " Jeff King
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=pull.1285.v2.git.1658002423864.gitgitgadget@gmail.com \
--to=gitgitgadget@gmail.com \
--cc=git@vger.kernel.org \
--cc=ziosombrero@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).