diff options
author | Junio C Hamano <gitster@pobox.com> | 2015-08-31 15:38:50 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2015-08-31 15:38:50 -0700 |
commit | fc9dfda1be25ab3bb311900c6cfbf59d6b6e224e (patch) | |
tree | 6a53a2a3de541f1c7155f4163086ab49a5c81a43 /contrib/completion/git-completion.bash | |
parent | Sync with 2.5.1 (diff) | |
parent | get_urlmatch: avoid useless strbuf write (diff) | |
download | tgif-fc9dfda1be25ab3bb311900c6cfbf59d6b6e224e.tar.xz |
Merge branch 'sg/config-name-only'
"git config --list" output was hard to parse when values consist of
multiple lines. "--name-only" option is added to help this.
* sg/config-name-only:
get_urlmatch: avoid useless strbuf write
format_config: simplify buffer handling
format_config: don't init strbuf
config: restructure format_config() for better control flow
completion: list variable names reliably with 'git config --name-only'
config: add '--name-only' option to list only variable names
Diffstat (limited to 'contrib/completion/git-completion.bash')
-rw-r--r-- | contrib/completion/git-completion.bash | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash index 3da7dc209d..482ca84b45 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 --name-only --get-regexp "^$section\..*" 2>/dev/null); do + echo "${i#$section.}" done } @@ -1777,15 +1776,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 --name-only --list 2>/dev/null } _git_config () @@ -1890,6 +1881,7 @@ _git_config () --get --get-all --get-regexp --add --unset --unset-all --remove-section --rename-section + --name-only " return ;; |