Re: [POC PATCH 5/5] completion: avoid compgen to fix expansion issues in __gitcomp_nl()
- From
SZEDER Gábor <szeder@ira.uka.de>
- Date
- Sep 28, 2012, 15:08 UTC
- Message-ID
- <20120928150852.GA13081@goldbirke>
- In-Reply-To
- <1348826975-2225-5-git-send-email-szeder@ira.uka.de>
On Fri, Sep 28, 2012 at 12:09:35PM +0200, SZEDER Gábor wrote:
Show 5 quoted lines
> __gitcomp_nl ()
> {
> local IFS=$'\n'
> - COMPREPLY=($(compgen -P "${2-}" -S "${4- }" -W "$1" -- "${3-$cur}"))
> + COMPREPLY=($(echo "$1" |sed -n "/^${3-$cur}/ {$cur can be a path, so it can contain /, which then breaks this sed expression. Here's a fixup:
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash index 2df865fd..d30f376f 100644 --- a/contrib/completion/git-completion.bash +++ b/contrib/completion/git-completion.bash @@ -260,8 +260,8 @@ __gitcomp () # appended. __gitcomp_nl () { - local IFS=$'\n' - COMPREPLY=($(echo "$1" |sed -n "/^${3-$cur}/ { + local IFS=$'\n' cur_=${3-$cur} + COMPREPLY=($(echo "$1" |sed -n "/^${cur_//\//\\/}/ { s/^/${2-}/ s/$/${4- }/ p
-- 1.7.12.1.490.g14283db