completions/git: fix arg completion for third-party git commands, again

Commit 50e595503e (completions/git: fix completions for third-party git
commands, 2025-03-03) wasn't quite right, as we can see in the linked
reproduction:

	$ fish_trace=1 complete -C 'git machete add --onto '
	----> complete -C git-machete\ add\n--onto\

The recursive completion invocation contains a spurious newline, which means
that "--onto" is the command name.  The newline is produced by "string escape
-- add --onto" inside a command substitution.

Fix this by interpreting newlines as list separators, and then joining
by spaces.

Fixes #11319
This commit is contained in:
Johannes Altmanninger
2025-03-25 09:58:32 +01:00
parent 5012bcb976
commit 360cfdb7ae
2 changed files with 6 additions and 2 deletions

View File

@@ -51,6 +51,10 @@ complete -C'git frobnicate --onto '
#CHECK: onto1
#CHECK: onto2
complete -C'git frobnicate graft --onto '
#CHECK: onto1
#CHECK: onto2
complete -C'git ' | grep '^add'\t
# (note: actual tab character in the check here)
#CHECK: add Add file contents to the staging area