diff options
author | Todd Zullinger <tmz@pobox.com> | 2009-09-11 19:23:45 -0400 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2009-09-13 13:40:25 -0700 |
commit | 518ef8f07f72271dff4040c1e7452ab6de73d199 (patch) | |
tree | 14b7b65d6637f664c1bba0747580a6c56754aca8 /contrib/completion | |
parent | 05d3951ec9c531d348fe0dbb9ae058d38728a550 (diff) | |
download | git-518ef8f07f72271dff4040c1e7452ab6de73d199.tar.gz git-518ef8f07f72271dff4040c1e7452ab6de73d199.tar.xz |
completion: Replace config --list with --get-regexp
James Bardin noted that the completion spewed warnings when no git config
file is present. This is likely a bug to be fixed in git config, but it's
also good to simplify the completion code by using the --get-regexp option
as Jeff King pointed out.
Signed-off-by: Todd Zullinger <tmz@pobox.com>
Trivially-acked-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'contrib/completion')
-rwxr-xr-x | contrib/completion/git-completion.bash | 30 |
1 files changed, 9 insertions, 21 deletions
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash index 98592040d..2d2d5794a 100755 --- a/contrib/completion/git-completion.bash +++ b/contrib/completion/git-completion.bash @@ -318,13 +318,9 @@ __git_remotes () echo ${i#$d/remotes/} done [ "$ngoff" ] && shopt -u nullglob - for i in $(git --git-dir="$d" config --list); do - case "$i" in - remote.*.url=*) - i="${i#remote.}" - echo "${i/.url=*/}" - ;; - esac + for i in $(git --git-dir="$d" config --get-regexp 'remote\..*\.url' 2>/dev/null); do + i="${i#remote.}" + echo "${i/.url*/}" done } @@ -605,13 +601,9 @@ __git_porcelain_commandlist="$(__git_porcelain_commands 2>/dev/null)" __git_aliases () { local i IFS=$'\n' - for i in $(git --git-dir="$(__gitdir)" config --list); do - case "$i" in - alias.*) - i="${i#alias.}" - echo "${i/=*/}" - ;; - esac + for i in $(git --git-dir="$(__gitdir)" config --get-regexp "alias\..*" 2>/dev/null); do + i="${i#alias.}" + echo "${i/ */}" done } @@ -1769,13 +1761,9 @@ _git_remote () ;; update) local i c='' IFS=$'\n' - for i in $(git --git-dir="$(__gitdir)" config --list); do - case "$i" in - remotes.*) - i="${i#remotes.}" - c="$c ${i/=*/}" - ;; - esac + for i in $(git --git-dir="$(__gitdir)" config --get-regexp "remotes\..*" 2>/dev/null); do + i="${i#remotes.}" + c="$c ${i/ */}" done __gitcomp "$c" ;; |