zsh-workers
 help / color / mirror / code / Atom feed
From: Roman Perepelitsa <roman.perepelitsa@gmail.com>
To: eliasghafari <eliasghafari@disroot.org>
Cc: zsh-workers@zsh.org
Subject: Re: [BUG]Filename autocompletion using git-bare repos (--git-dir=... --work-tree=...)
Date: Tue, 12 Sep 2023 21:33:13 +0200	[thread overview]
Message-ID: <CAN=4vMqeraa9JLzF_C6vFciP7YkJTsEH30mYUPpN4Sp=4un7zw@mail.gmail.com> (raw)
In-Reply-To: <wacpbrdxdhaaxzzenf4ocl63lklpod5v6sjvbgfywcz2o5xrna@q6bp3dzafenl>

On Tue, Sep 12, 2023 at 9:25 PM eliasghafari <eliasghafari@disroot.org> 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.


  reply	other threads:[~2023-09-12 19:33 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-12  8:54 eliasghafari
2023-09-12  9:34 ` Roman Perepelitsa
2023-09-12 19:25   ` eliasghafari
2023-09-12 19:33     ` Roman Perepelitsa [this message]
  -- strict thread matches above, loose matches on Subject: below --
2023-03-09 12:33 eliasghafari
2023-03-09 17:12 ` Bart Schaefer
2023-03-09 19:27 ` Oliver Kiddle
2023-03-10 10:07   ` Elias Ghafari
2023-03-10 10:12     ` Roman Perepelitsa
2023-09-11 15:05       ` Elias Ghafari
2023-09-12  2:26         ` Jun T

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAN=4vMqeraa9JLzF_C6vFciP7YkJTsEH30mYUPpN4Sp=4un7zw@mail.gmail.com' \
    --to=roman.perepelitsa@gmail.com \
    --cc=eliasghafari@disroot.org \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).