From: Felipe Contreras Date: Thu, 2 Feb 2012 09:05:29 +0000 (-0600) Subject: completion: use ls -1 instead of rolling a loop to do that ourselves X-Git-Tag: v1.7.9.2~16^2~1 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=d79f81adfe02a3f0eaf8deba5fb81dd220b72aae;p=git.git completion: use ls -1 instead of rolling a loop to do that ourselves This simplifies the code a great deal. In particular, it allows us to get rid of __git_shopt, which is used only in this fuction to enable 'nullglob' in zsh. [jn: squashed with a patch that actually gets rid of __git_shopt] Signed-off-by: Felipe Contreras Signed-off-by: Jonathan Nieder Signed-off-by: Junio C Hamano --- diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash index c63616608..ec6eed673 100755 --- a/contrib/completion/git-completion.bash +++ b/contrib/completion/git-completion.bash @@ -643,13 +643,8 @@ __git_refs_remotes () __git_remotes () { - local i ngoff IFS=$'\n' d="$(__gitdir)" - __git_shopt -q nullglob || ngoff=1 - __git_shopt -s nullglob - for i in "$d/remotes"/*; do - echo ${i#$d/remotes/} - done - [ "$ngoff" ] && __git_shopt -u nullglob + local i IFS=$'\n' d="$(__gitdir)" + test -d "$d/remotes" && ls -1 "$d/remotes" for i in $(git --git-dir="$d" config --get-regexp 'remote\..*\.url' 2>/dev/null); do i="${i#remote.}" echo "${i/.url*/}" @@ -2736,33 +2731,3 @@ if [ Cygwin = "$(uname -o 2>/dev/null)" ]; then complete -o bashdefault -o default -o nospace -F _git git.exe 2>/dev/null \ || complete -o default -o nospace -F _git git.exe fi - -if [[ -n ${ZSH_VERSION-} ]]; then - __git_shopt () { - local option - if [ $# -ne 2 ]; then - echo "USAGE: $0 (-q|-s|-u)