Skip to content

Commit

Permalink
git completion: Rename __fish_git_heads to __fish_git_refs
Browse files Browse the repository at this point in the history
In git speak, these are refs, while there can be several heads which are
refs in turn.
  • Loading branch information
gladhorn committed Jul 13, 2016
1 parent f08ac96 commit 06003f8
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions share/completions/git.fish
Expand Up @@ -24,7 +24,7 @@ function __fish_git_tags
command git tag ^/dev/null
end

function __fish_git_heads
function __fish_git_refs
__fish_git_branches
__fish_git_tags
end
Expand Down Expand Up @@ -57,13 +57,13 @@ function __fish_git_ranges
# If we didn't need to split (or there's nothing _to_ split), complete only the first part
# Note that status here is from `string split` because `set` doesn't alter it
if test -z "$from" -o $status -gt 0
__fish_git_heads
__fish_git_refs
return 0
end

set -l to (set -q both[2]; and echo $both[2])
for from_ref in (__fish_git_heads | string match "$from")
for to_ref in (__fish_git_heads | string match "*$to*") # if $to is empty, this correctly matches everything
for from_ref in (__fish_git_refs | string match "$from")
for to_ref in (__fish_git_refs | string match "*$to*") # if $to is empty, this correctly matches everything
printf "%s..%s\n" $from_ref $to_ref
end
end
Expand Down Expand Up @@ -290,7 +290,7 @@ complete -f -c git -n '__fish_git_using_command show' -a '(__fish_git_commits)'

### show-branch
complete -f -c git -n '__fish_git_needs_command' -a show-branch -d 'Shows the commits on branches'
complete -f -c git -n '__fish_git_using_command show-branch' -a '(__fish_git_heads)' --description 'Branch'
complete -f -c git -n '__fish_git_using_command show-branch' -a '(__fish_git_refs)' --description 'Branch'
# TODO options

### add
Expand Down Expand Up @@ -404,7 +404,7 @@ complete -f -c git -n '__fish_git_needs_command' -a init -d 'Create an empty git

### log
complete -c git -n '__fish_git_needs_command' -a log -d 'Show commit logs'
complete -c git -n '__fish_git_using_command log' -a '(__fish_git_heads) (__fish_git_ranges)' -d 'Branch'
complete -c git -n '__fish_git_using_command log' -a '(__fish_git_refs) (__fish_git_ranges)' -d 'Branch'
# TODO options

### merge
Expand Down

0 comments on commit 06003f8

Please sign in to comment.