mirror of
https://github.com/fish-shell/fish-shell
synced 2025-01-13 05:28:49 +00:00
git completion: Rename __fish_git_heads to __fish_git_refs
In git speak, these are refs, while there can be several heads which are refs in turn.
This commit is contained in:
parent
f08ac969e9
commit
06003f82ae
1 changed files with 6 additions and 6 deletions
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue