git.fish (fish-3.5.0.tar.xz) | : | git.fish (fish-3.5.1.tar.xz) | ||
---|---|---|---|---|
skipping to change at line 510 | skipping to change at line 510 | |||
# Lists files included in the index of a commit, branch, or tag (not necessarily HEAD) | # Lists files included in the index of a commit, branch, or tag (not necessarily HEAD) | |||
function __fish_git_rev_files | function __fish_git_rev_files | |||
set -l rev $argv[1] | set -l rev $argv[1] | |||
set -l path $argv[2] | set -l path $argv[2] | |||
# Strip any partial files from the path before handing it to `git show` | # Strip any partial files from the path before handing it to `git show` | |||
set -l path (string replace -r -- '(.*/|).*' '$1' $path) | set -l path (string replace -r -- '(.*/|).*' '$1' $path) | |||
# List files in $rev's index, skipping the "tree ..." header, but appending | # List files in $rev's index, skipping the "tree ..." header, but appending | |||
# the parent path, which git does not include in the output (and fish requir es) | # the parent path, which git does not include in the output (and fish requir es) | |||
printf "$path%s\n" (git show $rev:$path | sed '1,2d') | printf "$path%s\n" (__fish_git show $rev:$path | sed '1,2d') | |||
end | end | |||
# Provides __fish_git_rev_files completions for the current token | # Provides __fish_git_rev_files completions for the current token | |||
function __fish_git_complete_rev_files | function __fish_git_complete_rev_files | |||
set -l split (string split -m 1 ":" (commandline -ot)) | set -l split (string split -m 1 ":" -- (commandline -ot)) | |||
set -l rev $split[1] | set -l rev $split[1] | |||
set -l path $split[2] | set -l path $split[2] | |||
printf "$rev:%s\n" (__fish_git_rev_files $rev $path) | printf "$rev:%s\n" (__fish_git_rev_files $rev $path) | |||
end | end | |||
# Determines whether we can/should complete with __fish_git_rev_files | # Determines whether we can/should complete with __fish_git_rev_files | |||
function __fish_git_needs_rev_files | function __fish_git_needs_rev_files | |||
# git (as of 2.20) accepts the rev:path syntax for a number of subcommands, | # git (as of 2.20) accepts the rev:path syntax for a number of subcommands, | |||
# but then doesn't emit the expected (or any?) output, e.g. `git log master: foo` | # but then doesn't emit the expected (or any?) output, e.g. `git log master: foo` | |||
skipping to change at line 566 | skipping to change at line 566 | |||
set -l to $both[3] | set -l to $both[3] | |||
# Remove description from the from-ref, not the to-ref. | # Remove description from the from-ref, not the to-ref. | |||
for from_ref in $from_refs | for from_ref in $from_refs | |||
for to_ref in (__fish_git_refs | string match "*$to*") # if $to is empty , this correctly matches everything | for to_ref in (__fish_git_refs | string match "*$to*") # if $to is empty , this correctly matches everything | |||
printf "%s%s%s\n" $from_ref $dots $to_ref | printf "%s%s%s\n" $from_ref $dots $to_ref | |||
end | end | |||
end | end | |||
end | end | |||
function __fish_git_needs_command | ||||
# Figure out if the current invocation already has a command. | ||||
set -l cmd (commandline -opc) | ||||
set -e cmd[1] | ||||
argparse -s (__fish_git_global_optspecs) -- $cmd 2>/dev/null | ||||
or return 0 | ||||
# These flags function as commands, effectively. | ||||
set -q _flag_version; and return 1 | ||||
set -q _flag_html_path; and return 1 | ||||
set -q _flag_man_path; and return 1 | ||||
set -q _flag_info_path; and return 1 | ||||
if set -q argv[1] | ||||
# Also print the command, so this can be used to figure out what it is. | ||||
echo $argv[1] | ||||
return 1 | ||||
end | ||||
return 0 | ||||
end | ||||
function __fish_git_config_keys | function __fish_git_config_keys | |||
# Print already defined config values first | # Print already defined config values first | |||
# Config keys may span multiple lines, so parse using null char | # Config keys may span multiple lines, so parse using null char | |||
# With -z, key and value are separated by space, not "=" | # With -z, key and value are separated by space, not "=" | |||
__fish_git config -lz | while read -lz key value | __fish_git config -lz | while read -lz key value | |||
# Print only first line of value(with an ellipsis) if multiline | # Print only first line of value(with an ellipsis) if multiline | |||
printf '%s\t%s\n' $key (string replace \n …\n -- $value)[1] | printf '%s\t%s\n' $key (string replace \n …\n -- $value)[1] | |||
end | end | |||
# Print all recognized config keys; duplicates are not shown twice by fish | # Print all recognized config keys; duplicates are not shown twice by fish | |||
printf '%s\n' (__fish_git help --config)[1..-2] # Last line is a footer; ign ore it | printf '%s\n' (__fish_git help --config)[1..-2] # Last line is a footer; ign ore it | |||
skipping to change at line 617 | skipping to change at line 636 | |||
end | end | |||
git config -z --get-regexp 'alias\..*' | while read -lz alias cmdline | git config -z --get-regexp 'alias\..*' | while read -lz alias cmdline | |||
set -l command (__fish_git_aliased_command $cmdline) | set -l command (__fish_git_aliased_command $cmdline) | |||
string match -q --regex '\w+' -- $command; or continue | string match -q --regex '\w+' -- $command; or continue | |||
# Git aliases can contain chars that variable names can't - escape them. | # Git aliases can contain chars that variable names can't - escape them. | |||
set -l alias (string replace 'alias.' '' -- $alias | string escape --style=v ar) | set -l alias (string replace 'alias.' '' -- $alias | string escape --style=v ar) | |||
set -g __fish_git_alias_$alias $command $cmdline | set -g __fish_git_alias_$alias $command $cmdline | |||
end | end | |||
function __fish_git_needs_command | ||||
$__fish_git_needs_command | ||||
end | ||||
function __fish_git_using_command | function __fish_git_using_command | |||
contains $__fish_git_subcommand $argv | set -l cmd (__fish_git_needs_command) | |||
test -z "$cmd" | ||||
and return 1 | ||||
contains -- $cmd $argv | ||||
and return 0 | ||||
# Check aliases. | ||||
set -l varname __fish_git_alias_(string escape --style=var -- $cmd) | ||||
set -q $varname | ||||
and contains -- $$varname[1][1] $argv | ||||
and return 0 | ||||
return 1 | ||||
end | end | |||
function __fish_git_contains_opt | function __fish_git_contains_opt | |||
# Check if an option has been given | # Check if an option has been given | |||
# First check the commandline normally | # First check the commandline normally | |||
__fish_contains_opt $argv | __fish_contains_opt $argv | |||
and return | and return | |||
# Now check the alias | # Now check the alias | |||
argparse s= -- $argv | argparse s= -- $argv | |||
if set -q __fish_git_expanded_alias[1] | set -l cmd (__fish_git_needs_command) | |||
echo -- $__fish_git_expanded_alias | read -lat toks | set -l varname __fish_git_alias_(string escape --style=var -- $cmd) | |||
if set -q $varname | ||||
echo -- $$varname | read -lat toks | ||||
set toks (string replace -r '(-.*)=.*' '' -- $toks) | set toks (string replace -r '(-.*)=.*' '' -- $toks) | |||
for i in $argv | for i in $argv | |||
if contains -- --$i $toks | if contains -- --$i $toks | |||
return 0 | return 0 | |||
end | end | |||
end | end | |||
for i in $_flag_s | for i in $_flag_s | |||
if string match -qr -- "^-$i|^-[^-]*$i" $toks | if string match -qr -- "^-$i|^-[^-]*$i" $toks | |||
return 0 | return 0 | |||
skipping to change at line 1409 | skipping to change at line 1437 | |||
### init | ### init | |||
complete -f -c git -n __fish_git_needs_command -a init -d 'Create an empty git r epository or reinitialize an existing one' | complete -f -c git -n __fish_git_needs_command -a init -d 'Create an empty git r epository or reinitialize an existing one' | |||
complete -f -c git -n '__fish_git_using_command init' -s q -l quiet -d 'Only pri nt error and warning messages' | complete -f -c git -n '__fish_git_using_command init' -s q -l quiet -d 'Only pri nt error and warning messages' | |||
complete -f -c git -n '__fish_git_using_command init' -l bare -d 'Create a bare repository' | complete -f -c git -n '__fish_git_using_command init' -l bare -d 'Create a bare repository' | |||
# TODO options | # TODO options | |||
### log | ### log | |||
complete -c git -n __fish_git_needs_command -a shortlog -d 'Show commit shortlog ' | complete -c git -n __fish_git_needs_command -a shortlog -d 'Show commit shortlog ' | |||
complete -c git -n __fish_git_needs_command -a log -d 'Show commit logs' | complete -c git -n __fish_git_needs_command -a log -d 'Show commit logs' | |||
complete -c git -n '__fish_git_using_command log' -a '(git ls-files)' | complete -c git -n '__fish_git_using_command log' -a '(__fish_git ls-files)' | |||
complete -c git -n '__fish_git_using_command log' -n 'not contains -- -- (comman dline -opc)' -k -a '(__fish_git_ranges)' | complete -c git -n '__fish_git_using_command log' -n 'not contains -- -- (comman dline -opc)' -k -a '(__fish_git_ranges)' | |||
complete -c git -n '__fish_git_using_command log' -l follow -d 'Continue listing file history beyond renames' | complete -c git -n '__fish_git_using_command log' -l follow -d 'Continue listing file history beyond renames' | |||
complete -c git -n '__fish_git_using_command log' -l no-decorate -d 'Don\'t prin t ref names' | complete -c git -n '__fish_git_using_command log' -l no-decorate -d 'Don\'t prin t ref names' | |||
complete -f -c git -n '__fish_git_using_command log' -l decorate -a 'short\tHide \ prefixes full\tShow\ full\ ref\ names auto\tHide\ prefixes\ if\ printed\ to\ t erminal no\tDon\\\'t\ display\ ref' -d 'Print out ref names' | complete -f -c git -n '__fish_git_using_command log' -l decorate -a 'short\tHide \ prefixes full\tShow\ full\ ref\ names auto\tHide\ prefixes\ if\ printed\ to\ t erminal no\tDon\\\'t\ display\ ref' -d 'Print out ref names' | |||
complete -c git -n '__fish_git_using_command log' -l source -d 'Print ref name b y which each commit was reached' | complete -c git -n '__fish_git_using_command log' -l source -d 'Print ref name b y which each commit was reached' | |||
complete -c git -n '__fish_git_using_command log' -l use-mailmap | complete -c git -n '__fish_git_using_command log' -l use-mailmap | |||
complete -c git -n '__fish_git_using_command log' -l full-diff | complete -c git -n '__fish_git_using_command log' -l full-diff | |||
complete -c git -n '__fish_git_using_command log' -l log-size | complete -c git -n '__fish_git_using_command log' -l log-size | |||
complete -x -c git -n '__fish_git_using_command log' -s L | complete -x -c git -n '__fish_git_using_command log' -s L | |||
complete -x -c git -n '__fish_git_using_command log' -s n -l max-count -d 'Limit the number of commits before starting to show the commit output' | complete -x -c git -n '__fish_git_using_command log' -s n -l max-count -d 'Limit the number of commits before starting to show the commit output' | |||
skipping to change at line 1682 | skipping to change at line 1710 | |||
complete -f -c git -n __fish_git_needs_command -a mergetool -d 'Run merge confli ct resolution tools to resolve merge conflicts' | complete -f -c git -n __fish_git_needs_command -a mergetool -d 'Run merge confli ct resolution tools to resolve merge conflicts' | |||
complete -f -c git -n '__fish_git_using_command mergetool' -s t -l tool -d "Use specific merge resolution program" -a "(__fish_git_diffmerge_tools mergetool)" | complete -f -c git -n '__fish_git_using_command mergetool' -s t -l tool -d "Use specific merge resolution program" -a "(__fish_git_diffmerge_tools mergetool)" | |||
complete -f -c git -n '__fish_git_using_command mergetool' -l tool-help -d 'Prin t a list of merge tools that may be used with `--tool`' | complete -f -c git -n '__fish_git_using_command mergetool' -l tool-help -d 'Prin t a list of merge tools that may be used with `--tool`' | |||
complete -f -c git -n '__fish_git_using_command mergetool' -a "(__fish_git_files unmerged)" | complete -f -c git -n '__fish_git_using_command mergetool' -a "(__fish_git_files unmerged)" | |||
complete -f -c git -n '__fish_git_using_command mergetool' -s y -l no-prompt -d 'Do not prompt before launching a diff tool' | complete -f -c git -n '__fish_git_using_command mergetool' -s y -l no-prompt -d 'Do not prompt before launching a diff tool' | |||
complete -f -c git -n '__fish_git_using_command mergetool' -l prompt -d 'Prompt before each invocation of the merge resolution program' | complete -f -c git -n '__fish_git_using_command mergetool' -l prompt -d 'Prompt before each invocation of the merge resolution program' | |||
complete -c git -n '__fish_git_using_command mergetool' -s O -d 'Process files i n the order specified in the file passed as argument' | complete -c git -n '__fish_git_using_command mergetool' -s O -d 'Process files i n the order specified in the file passed as argument' | |||
### mv | ### mv | |||
complete -c git -n __fish_git_needs_command -a mv -d 'Move or rename a file, a d irectory, or a symlink' | complete -c git -n __fish_git_needs_command -a mv -d 'Move or rename a file, a d irectory, or a symlink' | |||
complete -f -c git -n '__fish_git_using_command mv' -a '(git ls-files)' | complete -f -c git -n '__fish_git_using_command mv' -a '(__fish_git ls-files)' | |||
complete -f -c git -n '__fish_git_using_command mv' -s f -l force -d 'Force rena me/moving even if target exists' | complete -f -c git -n '__fish_git_using_command mv' -s f -l force -d 'Force rena me/moving even if target exists' | |||
complete -f -c git -n '__fish_git_using_command mv' -s k -d 'Skip rename/move wh ich can lead to error' | complete -f -c git -n '__fish_git_using_command mv' -s k -d 'Skip rename/move wh ich can lead to error' | |||
complete -f -c git -n '__fish_git_using_command mv' -s n -l dry-run -d 'Only sho w what would happen' | complete -f -c git -n '__fish_git_using_command mv' -s n -l dry-run -d 'Only sho w what would happen' | |||
complete -f -c git -n '__fish_git_using_command mv' -s v -l verbose -d 'Report n ames of files as they are changed' | complete -f -c git -n '__fish_git_using_command mv' -s v -l verbose -d 'Report n ames of files as they are changed' | |||
### notes | ### notes | |||
set -l notescommands add copy append edit show merge remove # list prune get-ref | set -l notescommands add copy append edit show merge remove # list prune get-ref | |||
complete -c git -n __fish_git_needs_command -a notes -d 'Add or inspect object n otes' | complete -c git -n __fish_git_needs_command -a notes -d 'Add or inspect object n otes' | |||
complete -f -c git -n "__fish_git_using_command notes" -n "not __fish_seen_subco mmand_from $notescommands" -a list -d 'List notes for given object' | complete -f -c git -n "__fish_git_using_command notes" -n "not __fish_seen_subco mmand_from $notescommands" -a list -d 'List notes for given object' | |||
complete -f -c git -n "__fish_git_using_command notes" -n "not __fish_seen_subco mmand_from $notescommands" -a add -d 'Add notes for a given object' | complete -f -c git -n "__fish_git_using_command notes" -n "not __fish_seen_subco mmand_from $notescommands" -a add -d 'Add notes for a given object' | |||
skipping to change at line 2266 | skipping to change at line 2294 | |||
set -l subcommand (string replace -r -- '.*/git-([^/]*)$' '$1' $file) | set -l subcommand (string replace -r -- '.*/git-([^/]*)$' '$1' $file) | |||
# Already seen this command earlier in $PATH. | # Already seen this command earlier in $PATH. | |||
contains -- $subcommand $__fish_git_custom_commands_completion | contains -- $subcommand $__fish_git_custom_commands_completion | |||
and continue | and continue | |||
complete -c git -f -n "__fish_git_using_command $subcommand" -a "(__fish_git _complete_custom_command $subcommand)" | complete -c git -f -n "__fish_git_using_command $subcommand" -a "(__fish_git _complete_custom_command $subcommand)" | |||
set -a __fish_git_custom_commands_completion $subcommand | set -a __fish_git_custom_commands_completion $subcommand | |||
end | end | |||
complete -c git -f -a '( | ||||
set -g __fish_git_needs_command true | ||||
set -g __fish_git_subcommand "" | ||||
set -g __fish_git_expanded_alias | ||||
set -l cmd (commandline -opc) | ||||
set -e cmd[1] | ||||
argparse -s (__fish_git_global_optspecs) -- $cmd 2>/dev/null | ||||
or return | ||||
if set -q argv[1] || set -q _flag_version || set -q _flag_html_path || set - | ||||
q _flag_man_path || set -q _flag_info_path | ||||
set __fish_git_needs_command false | ||||
end | ||||
if set -q argv[1] | ||||
set -l subcommand $argv[1] | ||||
# TODO Expand recursive aliases. | ||||
set -l varname __fish_git_alias_(string escape --style=var -- $subcomman | ||||
d) | ||||
if set -q $varname | ||||
set -g __fish_git_expanded_alias $$varname | ||||
set subcommand $__fish_git_expanded_alias[1] | ||||
end | ||||
set -g __fish_git_subcommand "$subcommand" | ||||
end | ||||
)' | ||||
End of changes. 9 change blocks. | ||||
11 lines changed or deleted | 39 lines changed or added |