diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2018-12-01 02:29:42 +1300 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2018-12-01 02:29:42 +1300 |
commit | 0681de59778f82c9006de70ed9a9ee6644fd4a18 (patch) | |
tree | 1bba07ac51710494c17920f553dea26a69df55d0 /bash/bash_completion.d/git.bash | |
parent | Remove unneeded quoting in case statement (diff) | |
download | dotfiles-0681de59778f82c9006de70ed9a9ee6644fd4a18.tar.gz dotfiles-0681de59778f82c9006de70ed9a9ee6644fd4a18.zip |
Adjust loop short circuits and pattern matches
Diffstat (limited to 'bash/bash_completion.d/git.bash')
-rw-r--r-- | bash/bash_completion.d/git.bash | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/bash/bash_completion.d/git.bash b/bash/bash_completion.d/git.bash index 28313f76..a2edb468 100644 --- a/bash/bash_completion.d/git.bash +++ b/bash/bash_completion.d/git.bash @@ -12,9 +12,9 @@ _git() { refs) local ref while IFS= read -r ref ; do - [[ -n $ref ]] || continue ref=${ref#refs/*/} case $ref in + '') continue ;; "${COMP_WORDS[COMP_CWORD]}"*) COMPREPLY[${#COMPREPLY[@]}]=$ref ;; @@ -59,7 +59,8 @@ _git() { execpath=$(git --exec-path) || return local path for path in "$execpath"/git-"${COMP_WORDS[COMP_CWORD]}"* ; do - [[ -f $path ]] || continue + ! [[ -d $path ]] || continue + [[ -e $path ]] || continue [[ -x $path ]] || continue COMPREPLY[${#COMPREPLY[@]}]=${path#"$execpath"/git-} done |