]> git.ipfire.org Git - thirdparty/git.git/blobdiff - contrib/completion/git-completion.bash
bash: Classify cat-file and reflog as plumbing.
[thirdparty/git.git] / contrib / completion / git-completion.bash
index 7c7520ea29dfb26ffafc355ea739046b6d821e28..b87f96d9eadb0b99fbe3ce2c1e1c0e38b9601b13 100755 (executable)
@@ -1,7 +1,7 @@
 #
 # bash completion support for core Git.
 #
-# Copyright (C) 2006 Shawn Pearce
+# Copyright (C) 2006,2007 Shawn Pearce
 # Conceptually based on gitcompletion (http://gitweb.hawaga.org.uk/).
 #
 # The contained completion routines provide support for completing:
@@ -145,7 +145,7 @@ __git_remotes ()
                echo ${i#$d/remotes/}
        done
        [ "$ngoff" ] && shopt -u nullglob
-       for i in $(git --git-dir="$d" repo-config --list); do
+       for i in $(git --git-dir="$d" config --list); do
                case "$i" in
                remote.*.url=*)
                        i="${i#remote.}"
@@ -235,6 +235,7 @@ __git_commands ()
        for i in $(git help -a|egrep '^ ')
        do
                case $i in
+               cat-file)         : plumbing;;
                check-ref-format) : plumbing;;
                commit-tree)      : plumbing;;
                convert-objects)  : plumbing;;
@@ -258,6 +259,7 @@ __git_commands ()
                peek-remote)      : plumbing;;
                read-tree)        : plumbing;;
                receive-pack)     : plumbing;;
+               reflog)           : plumbing;;
                rerere)           : plumbing;;
                rev-list)         : plumbing;;
                rev-parse)        : plumbing;;
@@ -286,7 +288,7 @@ __git_commandlist="$(__git_commands 2>/dev/null)"
 __git_aliases ()
 {
        local i IFS=$'\n'
-       for i in $(git --git-dir="$(__gitdir)" repo-config --list); do
+       for i in $(git --git-dir="$(__gitdir)" config --list); do
                case "$i" in
                alias.*)
                        i="${i#alias.}"
@@ -299,7 +301,7 @@ __git_aliases ()
 __git_aliased_command ()
 {
        local word cmdline=$(git --git-dir="$(__gitdir)" \
-               repo-config --get "alias.$1")
+               config --get "alias.$1")
        for word in $cmdline; do
                if [ "${word##-*}" ]; then
                        echo $word
@@ -359,29 +361,13 @@ _git_apply ()
 _git_branch ()
 {
        local cur="${COMP_WORDS[COMP_CWORD]}"
-       COMPREPLY=($(compgen -W "-l -f -d -D $(__git_refs)" -- "$cur"))
-}
-
-_git_cat_file ()
-{
-       local cur="${COMP_WORDS[COMP_CWORD]}"
-       case "${COMP_WORDS[0]},$COMP_CWORD" in
-       git-cat-file*,1)
-               COMPREPLY=($(compgen -W "-p -t blob tree commit tag" -- "$cur"))
-               ;;
-       git,2)
-               COMPREPLY=($(compgen -W "-p -t blob tree commit tag" -- "$cur"))
-               ;;
-       *)
-               __git_complete_file
-               ;;
-       esac
+       COMPREPLY=($(compgen -W "$(__git_refs)" -- "$cur"))
 }
 
 _git_checkout ()
 {
        local cur="${COMP_WORDS[COMP_CWORD]}"
-       COMPREPLY=($(compgen -W "-l -b $(__git_refs)" -- "$cur"))
+       COMPREPLY=($(compgen -W "$(__git_refs)" -- "$cur"))
 }
 
 _git_cherry_pick ()
@@ -421,7 +407,7 @@ _git_diff ()
 _git_diff_tree ()
 {
        local cur="${COMP_WORDS[COMP_CWORD]}"
-       COMPREPLY=($(compgen -W "-r -p -M $(__git_refs)" -- "$cur"))
+       COMPREPLY=($(compgen -W "$(__git_refs)" -- "$cur"))
 }
 
 _git_fetch ()
@@ -629,7 +615,7 @@ _git_rebase ()
        COMPREPLY=($(compgen -W "$(__git_refs)" -- "$cur"))
 }
 
-_git_repo_config ()
+_git_config ()
 {
        local cur="${COMP_WORDS[COMP_CWORD]}"
        local prv="${COMP_WORDS[COMP_CWORD-1]}"
@@ -802,10 +788,10 @@ _git ()
        am)          _git_am ;;
        apply)       _git_apply ;;
        branch)      _git_branch ;;
-       cat-file)    _git_cat_file ;;
        checkout)    _git_checkout ;;
        cherry-pick) _git_cherry_pick ;;
        commit)      _git_commit ;;
+       config)      _git_config ;;
        diff)        _git_diff ;;
        diff-tree)   _git_diff_tree ;;
        fetch)       _git_fetch ;;
@@ -819,7 +805,7 @@ _git ()
        pull)        _git_pull ;;
        push)        _git_push ;;
        rebase)      _git_rebase ;;
-       repo-config) _git_repo_config ;;
+       repo-config) _git_config ;;
        reset)       _git_reset ;;
        show)        _git_show ;;
        show-branch) _git_log ;;
@@ -839,7 +825,6 @@ complete -o default            -F _gitk gitk
 complete -o default            -F _git_am git-am
 complete -o default            -F _git_apply git-apply
 complete -o default            -F _git_branch git-branch
-complete -o default -o nospace -F _git_cat_file git-cat-file
 complete -o default            -F _git_checkout git-checkout
 complete -o default            -F _git_cherry_pick git-cherry-pick
 complete -o default            -F _git_commit git-commit
@@ -856,7 +841,7 @@ complete -o default            -F _git_name_rev git-name-rev
 complete -o default -o nospace -F _git_pull git-pull
 complete -o default -o nospace -F _git_push git-push
 complete -o default            -F _git_rebase git-rebase
-complete -o default            -F _git_repo_config git-repo-config
+complete -o default            -F _git_config git-config
 complete -o default            -F _git_reset git-reset
 complete -o default -o nospace -F _git_show git-show
 complete -o default -o nospace -F _git_log git-show-branch
@@ -870,7 +855,6 @@ if [ Cygwin = "$(uname -o 2>/dev/null)" ]; then
 complete -o default            -F _git_apply git-apply.exe
 complete -o default -o nospace -F _git git.exe
 complete -o default            -F _git_branch git-branch.exe
-complete -o default -o nospace -F _git_cat_file git-cat-file.exe
 complete -o default -o nospace -F _git_diff git-diff.exe
 complete -o default -o nospace -F _git_diff_tree git-diff-tree.exe
 complete -o default -o nospace -F _git_format_patch git-format-patch.exe
@@ -879,7 +863,7 @@ complete -o default -o nospace -F _git_ls_tree git-ls-tree.exe
 complete -o default            -F _git_merge_base git-merge-base.exe
 complete -o default            -F _git_name_rev git-name-rev.exe
 complete -o default -o nospace -F _git_push git-push.exe
-complete -o default            -F _git_repo_config git-repo-config
+complete -o default            -F _git_config git-config
 complete -o default -o nospace -F _git_show git-show.exe
 complete -o default -o nospace -F _git_log git-show-branch.exe
 complete -o default -o nospace -F _git_log git-whatchanged.exe