Skip to content

Commit bedba53

Browse files
committed
fix fetch, pull, push refspec completion
regressed when we upgraded.
1 parent ccc7506 commit bedba53

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

git-completion.bash

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -412,9 +412,16 @@ __git_complete_revlist ()
412412

413413
__git_complete_remote_or_refspec ()
414414
{
415-
local cmd="${COMP_WORDS[1]}"
415+
local cmd="${COMP_WORDS[0]}"
416416
local cur="${COMP_WORDS[COMP_CWORD]}"
417-
local i c=2 remote="" pfx="" lhs=1 no_complete_refspec=0
417+
local i c=1 remote="" pfx="" lhs=1 no_complete_refspec=0
418+
419+
# adjust args upward when completing git *
420+
[ "$cmd" = "git" ] && {
421+
cmd="${COMP_WORDS[1]}"
422+
c=2
423+
}
424+
418425
while [ $c -lt $COMP_CWORD ]; do
419426
i="${COMP_WORDS[c]}"
420427
case "$i" in
@@ -792,7 +799,7 @@ _git_branch ()
792799

793800
_git_bundle ()
794801
{
795-
local cmd="${COMP_WORDS[2]}"
802+
local cmd="${COMP_WORDS[1]}"
796803
case "$COMP_CWORD" in
797804
2)
798805
__gitcomp "create list-heads verify unbundle"

0 commit comments

Comments
 (0)