]> git.ipfire.org Git - thirdparty/git.git/blobdiff - contrib/completion/git-completion.bash
bash: add git-branch options
[thirdparty/git.git] / contrib / completion / git-completion.bash
index 4ea727b14303e397117067993dbda446ed154ea1..8d6733abe4063cebbb0ac2d6e020077ed78fe438 100755 (executable)
@@ -91,7 +91,10 @@ __git_ps1 ()
                        fi
                        if ! b="$(git symbolic-ref HEAD 2>/dev/null)"
                        then
-                               b="$(cut -c1-7 $g/HEAD)..."
+                               if ! b="$(git describe --exact-match HEAD 2>/dev/null)"
+                               then
+                                       b="$(cut -c1-7 $g/HEAD)..."
+                               fi
                        fi
                fi
 
@@ -503,7 +506,16 @@ _git_bisect ()
 
 _git_branch ()
 {
-       __gitcomp "$(__git_refs)"
+       case "${COMP_WORDS[COMP_CWORD]}" in
+       --*=*)  COMPREPLY=() ;;
+       --*)
+               __gitcomp "
+                       --color --no-color --verbose --abbrev= --no-abbrev
+                       --track --no-track
+                       "
+               ;;
+       *)      __gitcomp "$(__git_refs)" ;;
+       esac
 }
 
 _git_bundle ()
@@ -645,6 +657,7 @@ _git_format_patch ()
                        --in-reply-to=
                        --full-index --binary
                        --not --all
+                       --cover-letter
                        "
                return
                ;;