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

Re: Zsh git filename completion with “--git-dir=… --work-tree=…”: not a git repository



On 10 August 2017 at 11:51, Tom M. <boojum@xxxxxxxxxxxxxxxxxxx> wrote:

>
> % grep dof .config/zsh/aliases
> alias dofenv='GIT_DIR=$HOME/.dotfiles/ GIT_WORK_TREE=$HOME'
> alias dof='dofenv git'
>

I redefined the above aliases as a function:
dof() {
    if [[ $(pwd) = ${HOME} ]]; then
        /usr/bin/git --git-dir=${HOME}/.dotfiles --work-tree=${HOME} $@
    else
        /usr/bin/git $@
    fi
}

But this doesn't work either:

% dof status
fatal: Not a git repository: '/home/user/dotfiles'

The weird thing is that this is working:

% dof --work-tree=$HOME status
On branch master
Your branch is up-to-date with 'origin/master'.

But completion for add still doesn't:

% dof --work-tree=$HOME add [Tab]
---- not a git repository

The issues seems to be solely with git add or, in my case with dof add.
Things like {dof,g} log or show work like expected. Am I missing something
here or is it a bug in zsh completion for git add?


T.


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