]> git.ipfire.org Git - thirdparty/git.git/blobdiff - contrib/completion/git-completion.bash
git-completion.bash - add support for git-bundle
[thirdparty/git.git] / contrib / completion / git-completion.bash
index 9e72f0f7b1668ba144397b6a6a2094d4294f5724..52b2893844ac4866573a078c0f99cc8fd6cd56f6 100755 (executable)
@@ -459,6 +459,35 @@ _git_branch ()
        __gitcomp "$(__git_refs)"
 }
 
+_git_bundle ()
+{
+       local mycword="$COMP_CWORD"
+       case "${COMP_WORDS[0]}" in
+       git)
+               local cmd="${COMP_WORDS[2]}"
+               mycword="$((mycword-1))"
+               ;;
+       git-bundle*)
+               local cmd="${COMP_WORDS[1]}"
+               ;;
+       esac
+       case "$mycword" in
+       1)
+               __gitcomp "create list-heads verify unbundle"
+               ;;
+       2)
+               # looking for a file
+               ;;
+       *)
+               case "$cmd" in
+                       create)
+                               __git_complete_revlist
+                       ;;
+               esac
+               ;;
+       esac
+}
+
 _git_checkout ()
 {
        __gitcomp "$(__git_refs)"
@@ -682,8 +711,11 @@ _git_push ()
                        esac
                        __gitcomp "$(__git_refs "$remote")" "" "${cur#*:}"
                        ;;
+               +*)
+                       __gitcomp "$(__git_refs)" + "${cur#+}"
+                       ;;
                *)
-                       __gitcomp "$(__git_refs2)"
+                       __gitcomp "$(__git_refs)"
                        ;;
                esac
                ;;
@@ -969,6 +1001,11 @@ _git_show ()
        __git_complete_file
 }
 
+_git_stash ()
+{
+       __gitcomp 'list show apply clear'
+}
+
 _git ()
 {
        local i c=1 command __git_dir
@@ -1001,6 +1038,7 @@ _git ()
        add)         _git_add ;;
        apply)       _git_apply ;;
        bisect)      _git_bisect ;;
+       bundle)      _git_bundle ;;
        branch)      _git_branch ;;
        checkout)    _git_checkout ;;
        cherry)      _git_cherry ;;
@@ -1025,6 +1063,7 @@ _git ()
        shortlog)    _git_shortlog ;;
        show)        _git_show ;;
        show-branch) _git_log ;;
+       stash)       _git_stash ;;
        whatchanged) _git_log ;;
        *)           COMPREPLY=() ;;
        esac
@@ -1048,6 +1087,7 @@ complete -o default -o nospace -F _git_am git-am
 complete -o default -o nospace -F _git_apply git-apply
 complete -o default -o nospace -F _git_bisect git-bisect
 complete -o default -o nospace -F _git_branch git-branch
+complete -o default -o nospace -F _git_bundle git-bundle
 complete -o default -o nospace -F _git_checkout git-checkout
 complete -o default -o nospace -F _git_cherry git-cherry
 complete -o default -o nospace -F _git_cherry_pick git-cherry-pick
@@ -1070,6 +1110,7 @@ complete -o default -o nospace -F _git_remote git-remote
 complete -o default -o nospace -F _git_reset git-reset
 complete -o default -o nospace -F _git_shortlog git-shortlog
 complete -o default -o nospace -F _git_show git-show
+complete -o default -o nospace -F _git_stash git-stash
 complete -o default -o nospace -F _git_log git-show-branch
 complete -o default -o nospace -F _git_log git-whatchanged
 
@@ -1082,6 +1123,7 @@ complete -o default -o nospace -F _git_add git-add.exe
 complete -o default -o nospace -F _git_apply git-apply.exe
 complete -o default -o nospace -F _git git.exe
 complete -o default -o nospace -F _git_branch git-branch.exe
+complete -o default -o nospace -F _git_bundle git-bundle.exe
 complete -o default -o nospace -F _git_cherry git-cherry.exe
 complete -o default -o nospace -F _git_diff git-diff.exe
 complete -o default -o nospace -F _git_format_patch git-format-patch.exe