Merge branch 'mp/complete-paths'
authorJunio C Hamano <gitster@pobox.com>
Mon, 11 Mar 2013 17:32:16 +0000 (10:32 -0700)
committerJunio C Hamano <gitster@pobox.com>
Mon, 11 Mar 2013 17:32:16 +0000 (10:32 -0700)
* mp/complete-paths:
git-completion.bash: zsh does not implement function redirection correctly

1  2 
contrib/completion/git-completion.bash
index b62bec027963edc8607067e990509b694cdbc9db,430566d33623b3c95359b2ae9fd958ab29dbe743..93eba467502282db2697e1cf6c93a6909d35ee5c
@@@ -299,9 -299,12 +299,12 @@@ __git_index_file_list_filter (
  # the second argument.
  __git_ls_files_helper ()
  {
-       # NOTE: $2 is not quoted in order to support multiple options
-       cd "$1" && git ls-files --exclude-standard $2
- } 2>/dev/null
+       (
+               test -n "${CDPATH+set}" && unset CDPATH
+               # NOTE: $2 is not quoted in order to support multiple options
+               cd "$1" && git ls-files --exclude-standard $2
+       ) 2>/dev/null
+ }
  
  
  # Execute git diff-index, returning paths relative to the directory
  # specified in the second argument.
  __git_diff_index_helper ()
  {
-       cd "$1" && git diff-index --name-only --relative "$2"
- } 2>/dev/null
+       (
+               test -n "${CDPATH+set}" && unset CDPATH
+               cd "$1" && git diff-index --name-only --relative "$2"
+       ) 2>/dev/null
+ }
  
  # __git_index_files accepts 1 or 2 arguments:
  # 1: Options to pass to ls-files (required).
@@@ -510,7 -516,7 +516,7 @@@ __git_complete_revlist_file (
                *)   pfx="$ref:$pfx" ;;
                esac
  
 -              __gitcomp_nl "$(git --git-dir="$(__gitdir)" ls-tree "$ls" \
 +              __gitcomp_nl "$(git --git-dir="$(__gitdir)" ls-tree "$ls" 2>/dev/null \
                                | sed '/^100... blob /{
                                           s,^.*        ,,
                                           s,$, ,
@@@ -684,19 -690,10 +690,19 @@@ __git_complete_strategy (
        return 1
  }
  
 +__git_commands () {
 +      if test -n "${GIT_TESTING_COMMAND_COMPLETION:-}"
 +      then
 +              printf "%s" "${GIT_TESTING_COMMAND_COMPLETION}"
 +      else
 +              git help -a|egrep '^  [a-zA-Z0-9]'
 +      fi
 +}
 +
  __git_list_all_commands ()
  {
        local i IFS=" "$'\n'
 -      for i in $(git help -a|egrep '^  [a-zA-Z0-9]')
 +      for i in $(__git_commands)
        do
                case $i in
                *--*)             : helper pattern;;
@@@ -725,7 -722,6 +731,7 @@@ __git_list_porcelain_commands (
                archimport)       : import;;
                cat-file)         : plumbing;;
                check-attr)       : plumbing;;
 +              check-ignore)     : plumbing;;
                check-ref-format) : plumbing;;
                checkout-index)   : plumbing;;
                commit-tree)      : plumbing;;
@@@ -1176,13 -1172,6 +1182,13 @@@ _git_commit (
                ;;
        esac
  
 +      case "$prev" in
 +      -c|-C)
 +              __gitcomp_nl "$(__git_refs)" "" "${cur}"
 +              return
 +              ;;
 +      esac
 +
        case "$cur" in
        --cleanup=*)
                __gitcomp "default strip verbatim whitespace
@@@ -1232,8 -1221,6 +1238,8 @@@ _git_describe (
        __gitcomp_nl "$(__git_refs)"
  }
  
 +__git_diff_algorithms="myers minimal patience histogram"
 +
  __git_diff_common_options="--stat --numstat --shortstat --summary
                        --patch-with-stat --name-only --name-status --color
                        --no-color --color-words --no-renames --check
                        --no-ext-diff
                        --no-prefix --src-prefix= --dst-prefix=
                        --inter-hunk-context=
 -                      --patience
 +                      --patience --histogram --minimal
                        --raw
                        --dirstat --dirstat= --dirstat-by-file
                        --dirstat-by-file= --cumulative
 +                      --diff-algorithm=
  "
  
  _git_diff ()
        __git_has_doubledash && return
  
        case "$cur" in
 +      --diff-algorithm=*)
 +              __gitcomp "$__git_diff_algorithms" "" "${cur##--diff-algorithm=}"
 +              return
 +              ;;
        --*)
                __gitcomp "--cached --staged --pickaxe-all --pickaxe-regex
                        --base --ours --theirs --no-index
@@@ -1786,7 -1768,7 +1792,7 @@@ __git_config_get_set_variables (
        while [ $c -gt 1 ]; do
                word="${words[c]}"
                case "$word" in
 -              --global|--system|--file=*)
 +              --system|--global|--local|--file=*)
                        config_file="$word"
                        break
                        ;;
@@@ -1892,7 -1874,7 +1898,7 @@@ _git_config (
        case "$cur" in
        --*)
                __gitcomp "
 -                      --global --system --file=
 +                      --system --global --local --file=
                        --list --replace-all
                        --get --get-all --get-regexp
                        --add --unset --unset-all
                diff.suppressBlankEmpty
                diff.tool
                diff.wordRegex
 +              diff.algorithm
                difftool.
                difftool.prompt
                fetch.recurseSubmodules
@@@ -2339,10 -2320,6 +2345,10 @@@ _git_show (
                        " "" "${cur#*=}"
                return
                ;;
 +      --diff-algorithm=*)
 +              __gitcomp "$__git_diff_algorithms" "" "${cur##--diff-algorithm=}"
 +              return
 +              ;;
        --*)
                __gitcomp "--pretty= --format= --abbrev-commit --oneline
                        $__git_diff_common_options
@@@ -2661,7 -2638,7 +2667,7 @@@ if [[ -n ${ZSH_VERSION-} ]]; the
                                --*=*|*.) ;;
                                *) c="$c " ;;
                                esac
 -                              array+=("$c")
 +                              array[$#array+1]="$c"
                        done
                        compset -P '*[=:]'
                        compadd -Q -S '' -p "${2-}" -a -- array && _ret=0