File tree Expand file tree Collapse file tree 2 files changed +18
-3
lines changed
Expand file tree Collapse file tree 2 files changed +18
-3
lines changed Original file line number Diff line number Diff line change 11# shellcheck shell=bash
22# bash completion support for git-extras.
33
4+ __gitex_heads_unique () {
5+ local branch specified=(" ${COMP_WORDS[@]: 2} " )
6+ for branch in $( __git_heads) ; do
7+ [[ " ${specified[*]} " == * " $branch " * ]] || printf ' %s\n' " $branch "
8+ done
9+ }
10+
411_git_authors (){
512 __gitcomp " -l --list --no-email"
613}
@@ -84,7 +91,7 @@ __git_cp(){
8491}
8592
8693_git_delete_branch (){
87- __gitcomp " $( __git_heads ) "
94+ __gitcomp " $( __gitex_heads_unique ) "
8895}
8996
9097_git_delete_squashed_branches (){
Original file line number Diff line number Diff line change @@ -72,6 +72,15 @@ __gitex_branch_names() {
7272 _wanted branch-names expl branch-name compadd $* - $branch_names
7373}
7474
75+ __gitex_branch_names_unique () {
76+ local expl
77+ declare -a branch_names already_specified
78+ branch_names=(${${(f)" $( _call_program branchrefs git for-each-ref --format=' "%(refname)"' refs/heads 2> /dev/null) " } # refs/ heads/ } )
79+ __gitex_command_successful || return
80+ already_specified=(${words[2,-1]} )
81+ _wanted branch-names expl branch-name compadd -F already_specified $* - $branch_names
82+ }
83+
7584__gitex_specific_branch_names () {
7685 local expl
7786 declare -a branch_names
@@ -196,8 +205,7 @@ _git-create-branch() {
196205}
197206
198207_git-delete-branch () {
199- _arguments \
200- ' :branch-name:__gitex_branch_names'
208+ __gitex_branch_names_unique
201209}
202210
203211_git-delete-squashed-branches () {
You can’t perform that action at this time.
0 commit comments