completions/git: Only use first line of alias as the description

This was a weird one. We split the aliases correctly even with
multiple lines, but then broke it all again when we just printed the
description.

Note that it would be possible to use `string split0` here, but since
anything longer than a line is likely too long for a description
anyway we don't bother.

Fixes #6946.
This commit is contained in:
Fabian Homborg 2020-04-26 08:47:14 +02:00
parent 6990c44443
commit 1988bd2579

View File

@ -621,7 +621,9 @@ function __fish_git_aliases
__fish_git config -z --get-regexp '^alias\.' 2>/dev/null | while read -lz key value
begin
set -l name (string replace -r '^.*\.' '' -- $key)
printf "%s\t%s\n" $name "Alias for $value"
# Only use the first line of the value as the description.
set -l val (printf '%s\n' $value)[1]
printf "%s\t%s\n" $name "Alias for $val"
end
end
end