Merge branch 'maint'
authorJunio C Hamano <gitster@pobox.com>
Wed, 28 Nov 2012 21:49:33 +0000 (13:49 -0800)
committerJunio C Hamano <gitster@pobox.com>
Wed, 28 Nov 2012 21:49:33 +0000 (13:49 -0800)
1  2 
contrib/completion/git-completion.bash
index 98f390ae46a6359d3a9d5f42fc2cce2186efd242,cda095de6b73b36c389003ad8c2f78f98aef1ae7..af13fcc440876f4b851724050548e399a4b90d31
  #    3) Consider changing your PS1 to also show the current branch,
  #       see git-prompt.sh for details.
  
 -if [[ -n ${ZSH_VERSION-} ]]; then
 -      autoload -U +X bashcompinit && bashcompinit
 -fi
 -
  case "$COMP_WORDBREAKS" in
  *:*) : great ;;
  *)   COMP_WORDBREAKS="$COMP_WORDBREAKS:"
@@@ -165,6 -169,7 +165,6 @@@ __git_reassemble_comp_words_by_ref(
  }
  
  if ! type _get_comp_words_by_ref >/dev/null 2>&1; then
 -if [[ -z ${ZSH_VERSION:+set} ]]; then
  _get_comp_words_by_ref ()
  {
        local exclude cur_ words_ cword_
                shift
        done
  }
 -else
 -_get_comp_words_by_ref ()
 -{
 -      while [ $# -gt 0 ]; do
 -              case "$1" in
 -              cur)
 -                      cur=${COMP_WORDS[COMP_CWORD]}
 -                      ;;
 -              prev)
 -                      prev=${COMP_WORDS[COMP_CWORD-1]}
 -                      ;;
 -              words)
 -                      words=("${COMP_WORDS[@]}")
 -                      ;;
 -              cword)
 -                      cword=$COMP_CWORD
 -                      ;;
 -              -n)
 -                      # assume COMP_WORDBREAKS is already set sanely
 -                      shift
 -                      ;;
 -              esac
 -              shift
 -      done
 -}
 -fi
  fi
  
  # Generates completion reply with compgen, appending a space to possible
@@@ -554,7 -585,7 +554,7 @@@ __git_list_porcelain_commands (
  {
        local i IFS=" "$'\n'
        __git_compute_all_commands
 -      for i in "help" $__git_all_commands
 +      for i in $__git_all_commands
        do
                case $i in
                *--*)             : helper pattern;;
@@@ -958,6 -989,8 +958,8 @@@ _git_clone (
                        --upload-pack
                        --template=
                        --depth
+                       --single-branch
+                       --branch
                        "
                return
                ;;
@@@ -1085,14 -1118,6 +1087,14 @@@ _git_fetch (
        __git_complete_remote_or_refspec
  }
  
 +__git_format_patch_options="
 +      --stdout --attach --no-attach --thread --thread= --output-directory
 +      --numbered --start-number --numbered-files --keep-subject --signoff
 +      --signature --no-signature --in-reply-to= --cc= --full-index --binary
 +      --not --all --cover-letter --no-prefix --src-prefix= --dst-prefix=
 +      --inline --suffix= --ignore-if-in-upstream --subject-prefix=
 +"
 +
  _git_format_patch ()
  {
        case "$cur" in
                return
                ;;
        --*)
 -              __gitcomp "
 -                      --stdout --attach --no-attach --thread --thread=
 -                      --output-directory
 -                      --numbered --start-number
 -                      --numbered-files
 -                      --keep-subject
 -                      --signoff --signature --no-signature
 -                      --in-reply-to= --cc=
 -                      --full-index --binary
 -                      --not --all
 -                      --cover-letter
 -                      --no-prefix --src-prefix= --dst-prefix=
 -                      --inline --suffix= --ignore-if-in-upstream
 -                      --subject-prefix=
 -                      "
 +              __gitcomp "$__git_format_patch_options"
                return
                ;;
        esac
@@@ -1517,12 -1556,6 +1519,12 @@@ _git_send_email (
                __gitcomp "ssl tls" "" "${cur##--smtp-encryption=}"
                return
                ;;
 +      --thread=*)
 +              __gitcomp "
 +                      deep shallow
 +                      " "" "${cur##--thread=}"
 +              return
 +              ;;
        --*)
                __gitcomp "--annotate --bcc --cc --cc-cmd --chain-reply-to
                        --compose --confirm= --dry-run --envelope-sender
                        --signed-off-by-cc --smtp-pass --smtp-server
                        --smtp-server-port --smtp-encryption= --smtp-user
                        --subject --suppress-cc= --suppress-from --thread --to
 -                      --validate --no-validate"
 +                      --validate --no-validate
 +                      $__git_format_patch_options"
                return
                ;;
        esac
 -      COMPREPLY=()
 +      __git_complete_revlist
  }
  
  _git_stage ()
@@@ -2399,69 -2431,20 +2401,69 @@@ __gitk_main (
        __git_complete_revlist
  }
  
 -__git_func_wrap ()
 -{
 -      if [[ -n ${ZSH_VERSION-} ]]; then
 -              emulate -L bash
 -              setopt KSH_TYPESET
 +if [[ -n ${ZSH_VERSION-} ]]; then
 +      echo "WARNING: this script is deprecated, please see git-completion.zsh" 1>&2
  
 -              # workaround zsh's bug that leaves 'words' as a special
 -              # variable in versions < 4.3.12
 -              typeset -h words
 +      __gitcomp ()
 +      {
 +              emulate -L zsh
  
 -              # workaround zsh's bug that quotes spaces in the COMPREPLY
 -              # array if IFS doesn't contain spaces.
 -              typeset -h IFS
 -      fi
 +              local cur_="${3-$cur}"
 +
 +              case "$cur_" in
 +              --*=)
 +                      ;;
 +              *)
 +                      local c IFS=$' \t\n'
 +                      local -a array
 +                      for c in ${=1}; do
 +                              c="$c${4-}"
 +                              case $c in
 +                              --*=*|*.) ;;
 +                              *) c="$c " ;;
 +                              esac
 +                              array+=("$c")
 +                      done
 +                      compset -P '*[=:]'
 +                      compadd -Q -S '' -p "${2-}" -a -- array && _ret=0
 +                      ;;
 +              esac
 +      }
 +
 +      __gitcomp_nl ()
 +      {
 +              emulate -L zsh
 +
 +              local IFS=$'\n'
 +              compset -P '*[=:]'
 +              compadd -Q -S "${4- }" -p "${2-}" -- ${=1} && _ret=0
 +      }
 +
 +      __git_zsh_helper ()
 +      {
 +              emulate -L ksh
 +              local cur cword prev
 +              cur=${words[CURRENT-1]}
 +              prev=${words[CURRENT-2]}
 +              let cword=CURRENT-1
 +              __${service}_main
 +      }
 +
 +      _git ()
 +      {
 +              emulate -L zsh
 +              local _ret=1
 +              __git_zsh_helper
 +              let _ret && _default -S '' && _ret=0
 +              return _ret
 +      }
 +
 +      compdef _git git gitk
 +      return
 +fi
 +
 +__git_func_wrap ()
 +{
        local cur words cword prev
        _get_comp_words_by_ref -n =: cur words cword prev
        $1