mirror of
https://github.com/fish-shell/fish-shell.git
synced 2025-02-27 14:08:56 +08:00
completions/git: Skip "!" shell-aliases for wrapping
We can't complete these, and now the user can do ``` set -g __fish_git_alias_$alias $command ``` e.g. ``` set -g __fish_git_alias_co checkout ``` if the arguments in the alias end up going to `git alias`. Fixes #5412. [ci skip]
This commit is contained in:
parent
288cfa8fb2
commit
91ecd3b9b5
@ -440,6 +440,12 @@ end
|
||||
# This is because alias:command is an n:1 mapping (an alias can only have one corresponding command,
|
||||
# but a command can be aliased multiple times)
|
||||
git config -z --get-regexp 'alias\..*' | while read -lz alias command _
|
||||
# If the command starts with a "!", it's a shell command, run with /bin/sh,
|
||||
# or any other shell defined at git's build time.
|
||||
#
|
||||
# We can't do anything with them, and we run git-config again for listing aliases,
|
||||
# so we skip them here.
|
||||
string match -q '!*' -- $command; and continue
|
||||
# Git aliases can contain chars that variable names can't - escape them.
|
||||
set alias (string replace 'alias.' '' -- $alias | string escape --style=var)
|
||||
set -g __fish_git_alias_$alias $command
|
||||
|
Loading…
x
Reference in New Issue
Block a user