git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] config.txt: add completion for include, includeIf

From
MGManuel Boni via GitGitGadget <gitgitgadget@gmail.com>
Date
Jul 13, 2022, 19:02 UTC
Message-ID
<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 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
Next: Jeff King
Message 1 of 6 in “config.txt: add completion for include, includeIf”
  1. config.txt: add completion for include, includeIfManuel Boni via GitGitGadget, Jul 13, 2022
  2. Jeff KingJul 13, 2022
  3. Junio C HamanoJul 13, 2022
  4. config.txt: document include, includeIfManuel Boni via GitGitGadget, Jul 16, 2022
  5. Jeff KingJul 16, 2022
  6. Jeff KingJul 14, 2022

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.