Skip to content

Commit 1c92e39

Browse files
committed
Merge branch 'sg/complete-symmetric-diff'
* sg/complete-symmetric-diff: bash: complete 'git diff ...branc<TAB>' bash: fix misindented esac statement in __git_complete_file()
2 parents 785d698 + 1d66ec5 commit 1c92e39

File tree

1 file changed

+17
-14
lines changed

1 file changed

+17
-14
lines changed

contrib/completion/git-completion.bash

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -664,11 +664,14 @@ __git_compute_merge_strategies ()
664664
: ${__git_merge_strategies:=$(__git_list_merge_strategies)}
665665
}
666666

667-
__git_complete_file ()
667+
__git_complete_revlist_file ()
668668
{
669669
local pfx ls ref cur
670670
_get_comp_words_by_ref -n =: cur
671671
case "$cur" in
672+
*..?*:*)
673+
return
674+
;;
672675
?*:*)
673676
ref="${cur%%:*}"
674677
cur="${cur#*:}"
@@ -682,7 +685,7 @@ __git_complete_file ()
682685
*)
683686
ls="$ref"
684687
;;
685-
esac
688+
esac
686689

687690
case "$COMP_WORDBREAKS" in
688691
*:*) : great ;;
@@ -707,17 +710,6 @@ __git_complete_file ()
707710
s/^.* //')" \
708711
-- "$cur"))
709712
;;
710-
*)
711-
__gitcomp "$(__git_refs)"
712-
;;
713-
esac
714-
}
715-
716-
__git_complete_revlist ()
717-
{
718-
local pfx cur
719-
_get_comp_words_by_ref -n =: cur
720-
case "$cur" in
721713
*...*)
722714
pfx="${cur%...*}..."
723715
cur="${cur#*...}"
@@ -734,6 +726,17 @@ __git_complete_revlist ()
734726
esac
735727
}
736728

729+
730+
__git_complete_file ()
731+
{
732+
__git_complete_revlist_file
733+
}
734+
735+
__git_complete_revlist ()
736+
{
737+
__git_complete_revlist_file
738+
}
739+
737740
__git_complete_remote_or_refspec ()
738741
{
739742
local cur words cword
@@ -1356,7 +1359,7 @@ _git_diff ()
13561359
return
13571360
;;
13581361
esac
1359-
__git_complete_file
1362+
__git_complete_revlist_file
13601363
}
13611364

13621365
__git_mergetools_common="diffuse ecmerge emerge kdiff3 meld opendiff

0 commit comments

Comments
 (0)