Squashed commit of the following:

commit 839e9c2ec00fcd72b19f1d415bee26af7f51f8aa
Author: lledey <lledey@gmail.com>
Date:   Tue Apr 23 13:28:23 2013 +0200

    Fix git branch completion if grep output is not the default one

    Signed-off-by: lledey <lledey@gmail.com>

commit 7798ed05744636f67d177bcb47d48d6aeca12787
Author: lledey <lledey@gmail.com>
Date:   Tue Apr 23 10:35:35 2013 +0200

    Fix git branch completion if grep output is not the default one

    Signed-off-by: lledey <lledey@gmail.com>
This commit is contained in:
ridiculousfish 2013-04-26 21:42:31 -07:00
parent f7708955b6
commit 807c5f2ef2

View File

@ -2,7 +2,7 @@
# Use 'command git' to avoid interactions for aliases from git to (e.g.) hub # Use 'command git' to avoid interactions for aliases from git to (e.g.) hub
function __fish_git_branches function __fish_git_branches
command git branch --no-color -a ^/dev/null | grep -v ' -> ' | sed -e 's/^..//' -e 's/^remotes\///' command git branch --no-color -a ^/dev/null | sgrep -v ' -> ' | sed -e 's/^..//' -e 's/^remotes\///'
end end
function __fish_git_tags function __fish_git_tags
@ -26,8 +26,8 @@ function __fish_git_ranges
end end
set -l to (commandline -ot | perl -ne 'if (index($_, "..") > 0) { my @parts = split(/\.\./); print $parts[1]; }') set -l to (commandline -ot | perl -ne 'if (index($_, "..") > 0) { my @parts = split(/\.\./); print $parts[1]; }')
for from_ref in (__fish_git_heads | grep -e "$from") for from_ref in (__fish_git_heads | sgrep -e "$from")
for to_ref in (__fish_git_heads | grep -e "$to") for to_ref in (__fish_git_heads | sgrep -e "$to")
printf "%s..%s\n" $from_ref $to_ref printf "%s..%s\n" $from_ref $to_ref
end end
end end
@ -236,7 +236,7 @@ complete -f -c git -n '__fish_git_using_command status' -l ignore-submodules -x
### tag ### tag
complete -f -c git -n '__fish_git_needs_command' -a tag -d 'Create, list, delete or verify a tag object signed with GPG' complete -f -c git -n '__fish_git_needs_command' -a tag -d 'Create, list, delete or verify a tag object signed with GPG'
complete -f -c git -n '__fish_git_using_command tag; and __fish_not_contain_opt -s d; and __fish_not_contain_opt -s v; and test (count (commandline -opc | grep -v -e \'^-\')) -eq 3' -a '(__fish_git_branches)' -d 'Branch' complete -f -c git -n '__fish_git_using_command tag; and __fish_not_contain_opt -s d; and __fish_not_contain_opt -s v; and test (count (commandline -opc | sgrep -v -e \'^-\')) -eq 3' -a '(__fish_git_branches)' -d 'Branch'
complete -f -c git -n '__fish_git_using_command tag' -s d -d 'Remove a tag' complete -f -c git -n '__fish_git_using_command tag' -s d -d 'Remove a tag'
complete -f -c git -n '__fish_git_using_command tag' -s v -d 'Verify signature of a tag' complete -f -c git -n '__fish_git_using_command tag' -s v -d 'Verify signature of a tag'
complete -f -c git -n '__fish_git_using_command tag' -s f -d 'Force overwriting exising tag' complete -f -c git -n '__fish_git_using_command tag' -s f -d 'Force overwriting exising tag'