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:
Fabian Homborg 2019-01-13 17:18:39 +01:00
parent 288cfa8fb2
commit 91ecd3b9b5

View File

@ -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