Skip to content

Commit

Permalink
Teach bash completion about 'git remote update'
Browse files Browse the repository at this point in the history
Recently the git-remote command grew an update subcommand, which
can be used to execute git-fetch across multiple repositories
in a single step.  These can be configured with the 'remotes.*'
configuration options, so we can offer completion for any name that
matches and appears to be useful to git-remote update.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
  • Loading branch information
Shawn O. Pearce committed May 24, 2007
1 parent c70680c commit fb72759
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions contrib/completion/git-completion.bash
Original file line number Diff line number Diff line change
Expand Up @@ -877,20 +877,32 @@ _git_remote ()
while [ $c -lt $COMP_CWORD ]; do
i="${COMP_WORDS[c]}"
case "$i" in
add|show|prune) command="$i"; break ;;
add|show|prune|update) command="$i"; break ;;
esac
c=$((++c))
done

if [ $c -eq $COMP_CWORD -a -z "$command" ]; then
__gitcomp "add show prune"
__gitcomp "add show prune update"
return
fi

case "$command" in
show|prune)
__gitcomp "$(__git_remotes)"
;;
update)
local i c='' IFS=$'\n'
for i in $(git --git-dir="$(__gitdir)" config --list); do
case "$i" in
remotes.*)
i="${i#remotes.}"
c="$c ${i/=*/}"
;;
esac
done
__gitcomp "$c"
;;
*)
COMPREPLY=()
;;
Expand Down

0 comments on commit fb72759

Please sign in to comment.