From 1988bd2579ef32345e3fc0b73a0f3b7ab514ce77 Mon Sep 17 00:00:00 2001 From: Fabian Homborg Date: Sun, 26 Apr 2020 08:47:14 +0200 Subject: [PATCH] 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. --- share/completions/git.fish | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/share/completions/git.fish b/share/completions/git.fish index f9b4a8a41..e9aebccdb 100644 --- a/share/completions/git.fish +++ b/share/completions/git.fish @@ -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