Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: [BUG]Filename autocompletion using git-bare repos (--git-dir=... --work-tree=...)
- X-seq: zsh-workers 52137
- From: Roman Perepelitsa <roman.perepelitsa@xxxxxxxxx>
- To: eliasghafari <eliasghafari@xxxxxxxxxxx>
- Cc: zsh-workers@xxxxxxx
- Subject: Re: [BUG]Filename autocompletion using git-bare repos (--git-dir=... --work-tree=...)
- Date: Tue, 12 Sep 2023 21:33:13 +0200
- Archived-at: <https://zsh.org/workers/52137>
- In-reply-to: <wacpbrdxdhaaxzzenf4ocl63lklpod5v6sjvbgfywcz2o5xrna@q6bp3dzafenl>
- List-id: <zsh-workers.zsh.org>
- References: <jayiekgd7doualsehpteuujj5cq4g5cuggfj7q72vsxaluacmd@wavkea46lupk> <CAN=4vMpe3NYqYTHiOp+ApRhfZ6EYEhXygVTE5hMP0uTtRr16og@mail.gmail.com> <wacpbrdxdhaaxzzenf4ocl63lklpod5v6sjvbgfywcz2o5xrna@q6bp3dzafenl>
On Tue, Sep 12, 2023 at 9:25 PM eliasghafari <eliasghafari@xxxxxxxxxxx> wrote:
>
> On 23/09/12 11:34AM, Roman Perepelitsa wrote:
> > Given these two definitions that differ only in quotes:
> >
> > alias c1="git --git-dir=$HOME/.local/share/dotfiles --work-tree $HOME"
> > alias c2='git --git-dir=$HOME/.local/share/dotfiles --work-tree $HOME'
> >
> > Can you confirm that the following two commands work as expected?
> >
> > c1 diff
> > c2 diff
> Yes they both work and give the info they're supposed to give.
>
> > Can you furthermore confirm that only the first of the following works
> > as expected while the second does not?
> >
> > c1 diff <TAB>
> > c2 diff <TAB>
> Also yes c1 autocompletion works perfectly, while c2 doesn't.
So there is indeed a bug in the git completer. I won't be debugging or
fixing this but someone else on this list might.
> For further info during my reading of the log produced by `config diff
> <C-x ?>` I noticed a couple of things, which if you want to investigate
> this, it might help you out.
> Using this alias: 'git --git-dir=$HOME/.local/share/dotfiles --work-tree ~'
>
> +_git:64> local -x GIT_DIR='$HOME/.local/share/dotfiles'
Yep, that's the culprit.
Everything else you mentioned below is as expected and not surprising.
> Using this alias: 'git --git-dir=~/.local/share/dotfiles --work-tree ~'
>
> [...] the command doesn't work it gives this error:
> warning: Not a git repository. Use --no-index to compare two paths outside a working tree
This is working as intended. The tilde isn't supposed to be expanded
and it isn't.
> And like I said 'git --git-dir ~/.local/share/dotfiles --work-tree ~'
> both works with autocompletion and the command line.
Of course.
> One last thing with config='git --git-dir ~/.local/share/dotfiles --work-tree ~'
> if I do `alias config` to show what the alias is set to, the output is
> exactly the same as above config=...
Right. This is as expected.
> But with config="git --git-dir=$HOME/.local/share/dotfiles --work-tree $HOME"
> alias config outputs:
> config='git --git-dir=/home/elias/.local/share/dotfiles --work-tree /home/elias'
Also as expected.
Roman.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author