[PATCH 3/3] completion: use specified file (if any) when completing config vars

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Only list the variables that can actually be affected by the command by
searching the arguments for a config file setting.

Signed-off-by: Stephen Boyd <bebarino@xxxxxxxxx>
---
 contrib/completion/git-completion.bash |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index f179cc8..8a9863b 100755
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -1349,7 +1349,10 @@ _git_send_email ()
 
 __git_config_get_set_variables ()
 {
-	for i in $(git --git-dir="$(__gitdir)" config --list); do
+	local args="--global --system --file= -f"
+	local config_file="$(__git_find_argument_and_value "$args")"
+	for i in $(git --git-dir="$(__gitdir)" config $config_file --list \
+			2>/dev/null); do
 		case "$i" in
 		*.*)
 			echo "${i/=*/}"
-- 
1.6.3.rc4.29.g8146

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]