summaryrefslogtreecommitdiff
path: root/contrib/completion
diff options
context:
space:
mode:
authorShawn O. Pearce <spearce@spearce.org>2006-11-05 11:25:25 (GMT)
committerJunio C Hamano <junkio@cox.net>2006-11-05 21:36:38 (GMT)
commita79c6551a315b26f2461dd9734defce88014b77b (patch)
tree4a8adc4951be3180b036256a99157b40f26b18b9 /contrib/completion
parente5d5b21fdf0ec0aebbfaca814a15d15a718544a2 (diff)
downloadgit-a79c6551a315b26f2461dd9734defce88014b77b.zip
git-a79c6551a315b26f2461dd9734defce88014b77b.tar.gz
git-a79c6551a315b26f2461dd9734defce88014b77b.tar.bz2
Remove more sed invocations from within bash completion.
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>
Diffstat (limited to 'contrib/completion')
-rwxr-xr-xcontrib/completion/git-completion.bash14
1 files changed, 7 insertions, 7 deletions
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index e4a32b6..a43a177 100755
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -83,15 +83,15 @@ __git_remotes ()
__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/"
;;
@@ -193,7 +193,7 @@ _git_fetch ()
*)
case "$cur" in
*:*)
- cur=$(echo "$cur" | sed 's/^.*://')
+ cur="${cur#*:}"
COMPREPLY=($(compgen -W "$(__git_refs)" -- "$cur"))
;;
*)
@@ -287,7 +287,7 @@ _git_push ()
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"))
;;
*)