-
-
Notifications
You must be signed in to change notification settings - Fork 982
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Pure does not respect $GIT_DIR and $GIT_WORK_TREE #546
Comments
It's possible to update the env info in the async worker via the Line 399 in 02643fd
There we change the directory, but it could just as well be an A good place to detect this could be in async_worker_eval "prompt_pure" "builtin cd -q ${(q)PWD}; export GIT_DIR=${(q)GIT_DIR}" ... The reason we're using |
Is that something that should be done user-side? Or within pure itself? |
Hmm, it could be either TBH. I guess the question is, do people rely on this functionality and expect Pure to obey the variables? Which is more intuitive? This should work: async_git_envs() {
async_worker_eval "prompt_pure" 'git_dir='"${(q)GIT_DIR}"'; git_work_tree='"${(q)GIT_WORK_TREE}"'; if [[ -n $git_dir ]]; then export GIT_DIR=$git_dir; else unset GIT_DIR; fi; if [[ -n $git_work_tree ]]; then export GIT_WORK_TREE=$git_work_tree; else unset GIT_WORK_TREE; fi'
}
add-zsh-hook preexec async_git_envs |
General information
With pure prompt, git status is not displayed if you use a different git dir path (and set
$GIT_DIR
and$GIT_WORK_TREE
accordingly).System report (output of
prompt_pure_system_report
):I have:
Problem description
$GIT_DIR
and$GIT_WORK_TREE
are not respected unless already set before prompt is loaded.Reproduction steps
./.notgit
dir:zsh
(from this shell)My
.zshrc
:Thoughts
I think this is related to the fact that the vcs_info stuff is done in an async subshell(?). When you export the git env vars, they aren't passed to the async processes, so they don't take them into account.
Is there any way to have the async process get these variables after it's initialized? It doesn't have to be immediate (since, you know, it's async), but the next vcs_info check should be passed these variables.
The text was updated successfully, but these errors were encountered: