Merge branch 'sg/completion-no-column'
authorJunio C Hamano <gitster@pobox.com>
Mon, 21 Dec 2015 18:59:06 +0000 (10:59 -0800)
committerJunio C Hamano <gitster@pobox.com>
Mon, 21 Dec 2015 18:59:06 +0000 (10:59 -0800)
The completion script (in contrib/) used to list "git column"
(which is not an end-user facing command) as one of the choices

* sg/completion-no-column:
  completion: remove 'git column' from porcelain commands

1  2 
contrib/completion/git-completion.bash

@@@ -10,7 -10,6 +10,7 @@@
  #    *) local and remote tag names
  #    *) .git/remotes file names
  #    *) git 'subcommands'
 +#    *) git email aliases for git-send-email
  #    *) tree paths within 'ref:path/to/file' expressions
  #    *) file paths within current working directory and index
  #    *) common --long-options
@@@ -664,10 -663,11 +664,11 @@@ __git_list_porcelain_commands (
                check-mailmap)    : plumbing;;
                check-ref-format) : plumbing;;
                checkout-index)   : plumbing;;
+               column)           : internal helper;;
                commit-tree)      : plumbing;;
                count-objects)    : infrequent;;
 -              credential-cache) : credentials helper;;
 -              credential-store) : credentials helper;;
 +              credential)       : credentials;;
 +              credential-*)     : credentials helper;;
                cvsexportcommit)  : export;;
                cvsimport)        : import;;
                cvsserver)        : daemon;;
  __git_porcelain_commands=
  __git_compute_porcelain_commands ()
  {
 -      __git_compute_all_commands
        test -n "$__git_porcelain_commands" ||
        __git_porcelain_commands=$(__git_list_porcelain_commands)
  }
  
 -__git_pretty_aliases ()
 +# Lists all set config variables starting with the given section prefix,
 +# with the prefix removed.
 +__git_get_config_variables ()
  {
 -      local i IFS=$'\n'
 -      for i in $(git --git-dir="$(__gitdir)" config --get-regexp "pretty\..*" 2>/dev/null); do
 -              case "$i" in
 -              pretty.*)
 -                      i="${i#pretty.}"
 -                      echo "${i/ */}"
 -                      ;;
 -              esac
 +      local section="$1" i IFS=$'\n'
 +      for i in $(git --git-dir="$(__gitdir)" config --name-only --get-regexp "^$section\..*" 2>/dev/null); do
 +              echo "${i#$section.}"
        done
  }
  
 +__git_pretty_aliases ()
 +{
 +      __git_get_config_variables "pretty"
 +}
 +
  __git_aliases ()
  {
 -      local i IFS=$'\n'
 -      for i in $(git --git-dir="$(__gitdir)" config --get-regexp "alias\..*" 2>/dev/null); do
 -              case "$i" in
 -              alias.*)
 -                      i="${i#alias.}"
 -                      echo "${i/ */}"
 -                      ;;
 -              esac
 -      done
 +      __git_get_config_variables "alias"
  }
  
  # __git_aliased_command requires 1 argument
@@@ -1667,10 -1674,7 +1668,10 @@@ _git_push (
  _git_rebase ()
  {
        local dir="$(__gitdir)"
 -      if [ -d "$dir"/rebase-apply ] || [ -d "$dir"/rebase-merge ]; then
 +      if [ -f "$dir"/rebase-merge/interactive ]; then
 +              __gitcomp "--continue --skip --abort --edit-todo"
 +              return
 +      elif [ -d "$dir"/rebase-apply ] || [ -d "$dir"/rebase-merge ]; then
                __gitcomp "--continue --skip --abort"
                return
        fi
@@@ -1712,15 -1716,6 +1713,15 @@@ __git_send_email_suppresscc_options="au
  
  _git_send_email ()
  {
 +      case "$prev" in
 +      --to|--cc|--bcc|--from)
 +              __gitcomp "
 +              $(git --git-dir="$(__gitdir)" send-email --dump-aliases 2>/dev/null)
 +              "
 +              return
 +              ;;
 +      esac
 +
        case "$cur" in
        --confirm=*)
                __gitcomp "
                        " "" "${cur##--thread=}"
                return
                ;;
 +      --to=*|--cc=*|--bcc=*|--from=*)
 +              __gitcomp "
 +              $(git --git-dir="$(__gitdir)" send-email --dump-aliases 2>/dev/null)
 +              " "" "${cur#--*=}"
 +              return
 +              ;;
        --*)
                __gitcomp "--annotate --bcc --cc --cc-cmd --chain-reply-to
                        --compose --confirm= --dry-run --envelope-sender
@@@ -1792,7 -1781,15 +1793,7 @@@ __git_config_get_set_variables (
                c=$((--c))
        done
  
 -      git --git-dir="$(__gitdir)" config $config_file --list 2>/dev/null |
 -      while read -r line
 -      do
 -              case "$line" in
 -              *.*=*)
 -                      echo "${line/=*/}"
 -                      ;;
 -              esac
 -      done
 +      git --git-dir="$(__gitdir)" config $config_file --name-only --list 2>/dev/null
  }
  
  _git_config ()
                        --get --get-all --get-regexp
                        --add --unset --unset-all
                        --remove-section --rename-section
 +                      --name-only
                        "
                return
                ;;
                http.noEPSV
                http.postBuffer
                http.proxy
 +              http.sslCipherList
 +              http.sslVersion
                http.sslCAInfo
                http.sslCAPath
                http.sslCert
@@@ -2267,7 -2261,12 +2268,7 @@@ _git_remote (
                __git_complete_remote_or_refspec
                ;;
        update)
 -              local i c='' IFS=$'\n'
 -              for i in $(git --git-dir="$(__gitdir)" config --get-regexp "remotes\..*" 2>/dev/null); do
 -                      i="${i#remotes.}"
 -                      c="$c ${i/ */}"
 -              done
 -              __gitcomp "$c"
 +              __gitcomp "$(__git_get_config_variables "remotes")"
                ;;
        *)
                ;;
@@@ -2294,11 -2293,6 +2295,11 @@@ _git_reset (
  
  _git_revert ()
  {
 +      local dir="$(__gitdir)"
 +      if [ -f "$dir"/REVERT_HEAD ]; then
 +              __gitcomp "--continue --quit --abort"
 +              return
 +      fi
        case "$cur" in
        --*)
                __gitcomp "--edit --mainline --no-edit --no-commit --signoff"