Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Bug report; git tab-completion on macOS within paths containing unicode characters



Hey, thanks for looking into this! I did a quick test, where I
manually applied the patch to
`/opt/homebrew/Cellar/zsh/5.9/share/zsh/functions/_git` of my
currently running install (the only file by the name of `_git` that I
could `find`). As far as I could tell, that had no effect (I did open
a new terminal, but I didn't do a fresh OS login). Also, for me, `git
ls-files` seems to work normally independent of having unicode
characters in the path or not. I did find a somewhat related issue on
the fish issue tracker:
https://github.com/fish-shell/fish-shell/issues/474, suggesting that
this is in fact specific to the filesystem being used. The thread
suggests that bash managed to fix this issue. The obvious solution is
that whatever function/program does the globbing should apply some
form of unicode normalisation to both sides before the match (is this
what `qqqq` does here?). However, apparently that's easier said than
done.


On Sat, 27 Apr 2024 at 21:31, Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
>
> On Sat, Apr 27, 2024 at 12:14 PM Bart Schaefer
> <schaefer@xxxxxxxxxxxxxxxx> wrote:
> >
> > I'm uncertain that this is zsh's fault.  "git ls-files" is returning
> > that the directory is not a git repository, at least when I try to
> > reproduce.
>
> See if this helps -- I'm not sure this is the only (or even best)
> place to apply a change, but I'm curious whether it improves your
> results.
>
> diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git
> index 7370aaead..47c386106 100644
> --- a/Completion/Unix/Command/_git
> +++ b/Completion/Unix/Command/_git
> @@ -7526,7 +7526,7 @@ __git_files () {
>    # TODO: --directory should probably be added to $opts when --others is given.
>
>    local pref=${(Q)${~PREFIX}}
> -  [[ $pref[1] == '/' ]] || pref=$gittoplevel$gitprefix$pref
> +  [[ $pref[1] == '/' ]] || pref=${(qqqq)gittoplevel}$gitprefix$pref
>
>    # First allow ls-files to pattern-match in case of remote repository. Use the
>    # icase pathspec magic word to ensure that we support case-insensitive path




Messages sorted by: Reverse Date, Date, Thread, Author