git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Manuel Boni via GitGitGadget" <gitgitgadget@gmail.com>
To: git@vger.kernel.org
Cc: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>,
	"Manuel Boni" <ziosombrero@gmail.com>,
	"Manuel Boni" <ziosombrero@gmail.com>
Subject: [PATCH] config.txt: add completion for include, includeIf
Date: Wed, 13 Jul 2022 19:02:16 +0000	[thread overview]
Message-ID: <pull.1285.git.1657738937049.gitgitgadget@gmail.com> (raw)

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 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.

Credit for the ideas behind this patch goes to
Ævar Arnfjörð Bjarmason.

Signed-off-by: Manuel Boni <ziosombrero@gmail.com>
Based-on-patch-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
---
    config.txt: add completion for include, includeIf

Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-1285%2Fziosombrero%2Fcomp-config-include-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-1285/ziosombrero/comp-config-include-v1
Pull-Request: https://github.com/gitgitgadget/git/pull/1285

 Documentation/config/includeif.txt |  6 ++++++
 t/t9902-completion.sh              | 13 +++++++++++++
 2 files changed, 19 insertions(+)
 create mode 100644 Documentation/config/includeif.txt

diff --git a/Documentation/config/includeif.txt b/Documentation/config/includeif.txt
new file mode 100644
index 00000000000..18248cf462e
--- /dev/null
+++ b/Documentation/config/includeif.txt
@@ -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.
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: 30cc8d0f147546d4dd77bf497f4dec51e7265bd8
-- 
gitgitgadget

             reply	other threads:[~2022-07-13 19:02 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-13 19:02 Manuel Boni via GitGitGadget [this message]
2022-07-13 19:32 ` [PATCH] config.txt: add completion for include, includeIf 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 ` [PATCH v2] config.txt: document " Manuel Boni via GitGitGadget
2022-07-16 22:49   ` 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.git.1657738937049.gitgitgadget@gmail.com \
    --to=gitgitgadget@gmail.com \
    --cc=avarab@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).