summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: e5d5b21)
raw | patch | inline | side by side (parent: e5d5b21)
author | Shawn O. Pearce <spearce@spearce.org> | |
Sun, 5 Nov 2006 11:25:25 +0000 (06:25 -0500) | ||
committer | Junio C Hamano <junkio@cox.net> | |
Sun, 5 Nov 2006 21:36:38 +0000 (13:36 -0800) |
This change removes between 1 and 4 sed invocations per completion
entered by the user. In the case of cat-file the 4 invocations per
completion can take a while on Cygwin; running these replacements
directly within bash saves some time for the end user.
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
entered by the user. In the case of cat-file the 4 invocations per
completion can take a while on Cygwin; running these replacements
directly within bash saves some time for the end user.
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
contrib/completion/git-completion.bash | patch | blob | history |
index e4a32b61b279a8260e4de8175cc6f8885c833937..a43a177160b3b2952e4025bebc47c820ff4003f7 100755 (executable)
__git_complete_file ()
{
- local cur="${COMP_WORDS[COMP_CWORD]}"
+ local pfx ls ref cur="${COMP_WORDS[COMP_CWORD]}"
case "$cur" in
?*:*)
- local pfx ls ref="$(echo "$cur" | sed 's,:.*$,,')"
- cur="$(echo "$cur" | sed 's,^.*:,,')"
+ ref="${cur%%:*}"
+ cur="${cur#*:}"
case "$cur" in
?*/*)
- pfx="$(echo "$cur" | sed 's,/[^/]*$,,')"
- cur="$(echo "$cur" | sed 's,^.*/,,')"
+ pfx="${cur%/*}"
+ cur="${cur##*/}"
ls="$ref:$pfx"
pfx="$pfx/"
;;
*)
case "$cur" in
*:*)
- cur=$(echo "$cur" | sed 's/^.*://')
+ cur="${cur#*:}"
COMPREPLY=($(compgen -W "$(__git_refs)" -- "$cur"))
;;
*)
git-push) remote="${COMP_WORDS[1]}" ;;
git) remote="${COMP_WORDS[2]}" ;;
esac
- cur=$(echo "$cur" | sed 's/^.*://')
+ cur="${cur#*:}"
COMPREPLY=($(compgen -W "$(__git_refs "$remote")" -- "$cur"))
;;
*)