Merge branch 'fc/simplify-complete-revlist-file'
authorJunio C Hamano <gitster@pobox.com>
Mon, 14 May 2012 18:50:57 +0000 (11:50 -0700)
committerJunio C Hamano <gitster@pobox.com>
Mon, 14 May 2012 18:50:57 +0000 (11:50 -0700)
By Felipe Contreras
* fc/simplify-complete-revlist-file:
completion: simplify __git_complete_revlist_file

1  2 
contrib/completion/git-completion.bash
index 9f56ec7a6bde4b195b6e960e38e5403ce0b001b0,d877a2315c0470c96acaa3e065889a085c47fbac..2f60825b21e33d8a00d1763d9bcad4dc6e6a60a7
@@@ -304,16 -304,16 +304,16 @@@ __git_ps1 (
        fi
  }
  
 -# __gitcomp_1 requires 2 arguments
  __gitcomp_1 ()
  {
 -      local c IFS=' '$'\t'$'\n'
 +      local c IFS=$' \t\n'
        for c in $1; do
 -              case "$c$2" in
 -              --*=*) printf %s$'\n' "$c$2" ;;
 -              *.)    printf %s$'\n' "$c$2" ;;
 -              *)     printf %s$'\n' "$c$2 " ;;
 +              c="$c$2"
 +              case $c in
 +              --*=*|*.) ;;
 +              *) c="$c " ;;
                esac
 +              printf '%s\n' "$c"
        done
  }
  
@@@ -676,9 -676,7 +676,7 @@@ __git_complete_revlist_file (
                *)   pfx="$ref:$pfx" ;;
                esac
  
-               local IFS=$'\n'
-               COMPREPLY=($(compgen -P "$pfx" \
-                       -W "$(git --git-dir="$(__gitdir)" ls-tree "$ls" \
+               __gitcomp_nl "$(git --git-dir="$(__gitdir)" ls-tree "$ls" \
                                | sed '/^100... blob /{
                                           s,^.*        ,,
                                           s,$, ,
                                           s,$,/,
                                       }
                                       s/^.*    //')" \
-                       -- "$cur_"))
+                       "$pfx" "$cur_" ""
                ;;
        *...*)
                pfx="${cur_%...*}..."
@@@ -1658,7 -1656,7 +1656,7 @@@ _git_notes (
                __gitcomp '--ref'
                ;;
        ,*)
 -              case "${words[cword-1]}" in
 +              case "$prev" in
                --ref)
                        __gitcomp_nl "$(__git_refs)"
                        ;;
        prune,*)
                ;;
        *)
 -              case "${words[cword-1]}" in
 +              case "$prev" in
                -m|-F)
                        ;;
                *)
@@@ -2623,9 -2621,8 +2621,9 @@@ _git (
                case "$i" in
                --git-dir=*) __git_dir="${i#--git-dir=}" ;;
                --bare)      __git_dir="." ;;
 -              --version|-p|--paginate) ;;
                --help) command="help"; break ;;
 +              -c) c=$((++c)) ;;
 +              -*) ;;
                *) command="$i"; break ;;
                esac
                ((c++))
                        --bare
                        --version
                        --exec-path
 +                      --exec-path=
                        --html-path
 +                      --info-path
                        --work-tree=
                        --namespace=
 +                      --no-replace-objects
                        --help
                        "
                        ;;