git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: "SZEDER Gábor" <szeder@ira.uka.de>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org, "SZEDER Gábor" <szeder@ira.uka.de>
Subject: [PATCH 2/2] completion: use new 'git config' options to reliably list variable names
Date: Wed, 27 May 2015 22:07:20 +0200	[thread overview]
Message-ID: <1432757240-4445-2-git-send-email-szeder@ira.uka.de> (raw)
In-Reply-To: <1432757240-4445-1-git-send-email-szeder@ira.uka.de>

List all set config variable names with 'git config --list-names' instead
of '--list' post processing.  Similarly, use 'git config
--get-name-regexp' instead of '--get-regexp' to get config variables in a
given section.

Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
---
 contrib/completion/git-completion.bash | 15 +++------------
 1 file changed, 3 insertions(+), 12 deletions(-)

diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 6abbd56..121aa31 100644
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -744,9 +744,8 @@ __git_compute_porcelain_commands ()
 __git_get_config_variables ()
 {
 	local section="$1" i IFS=$'\n'
-	for i in $(git --git-dir="$(__gitdir)" config --get-regexp "^$section\..*" 2>/dev/null); do
-		i="${i#$section.}"
-		echo "${i/ */}"
+	for i in $(git --git-dir="$(__gitdir)" config --get-name-regexp "^$section\..*" 2>/dev/null); do
+		echo "${i#$section.}"
 	done
 }
 
@@ -1774,15 +1773,7 @@ __git_config_get_set_variables ()
 		c=$((--c))
 	done
 
-	git --git-dir="$(__gitdir)" config $config_file --list 2>/dev/null |
-	while read -r line
-	do
-		case "$line" in
-		*.*=*)
-			echo "${line/=*/}"
-			;;
-		esac
-	done
+	git --git-dir="$(__gitdir)" config $config_file --list-names 2>/dev/null
 }
 
 _git_config ()
-- 
2.4.2.347.ge926c0d

  reply	other threads:[~2015-05-27 20:07 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-27 20:07 [PATCH 1/2] config: add options to list only variable names SZEDER Gábor
2015-05-27 20:07 ` SZEDER Gábor [this message]
2015-05-27 20:11   ` [PATCH 1.5/2] " SZEDER Gábor
2015-05-28 12:06     ` Christian Couder
2015-05-27 21:05   ` [PATCH 2/2] completion: use new 'git config' options to reliably list " Jeff King
2015-05-27 21:04 ` [PATCH 1/2] config: add options to list only " Jeff King
2015-05-27 21:08   ` Jeff King
2015-05-27 21:34   ` SZEDER Gábor
2015-05-27 22:20 ` Junio C Hamano
2015-05-28 12:29 ` [PATCH v2 0/2] config: list only variable names for completion SZEDER Gábor
2015-05-28 12:29   ` [PATCH v2 1/2] config: add options to list only variable names SZEDER Gábor
2015-05-28 19:20     ` Junio C Hamano
2015-05-28 19:36       ` Junio C Hamano
2015-05-29 11:34       ` Christian Couder
2015-05-29 11:39         ` Jeff King
2015-05-28 12:29   ` [PATCH v2 2/2] completion: use new 'git config' options to reliably list " SZEDER Gábor
2015-05-28 20:39   ` [PATCH v2 0/2] config: list only variable names for completion 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

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1432757240-4445-2-git-send-email-szeder@ira.uka.de \
    --to=szeder@ira.uka.de \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).