Skip to content
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

git async prompt does not appear #12328

Open
carlosala opened this issue Apr 6, 2024 · 18 comments
Open

git async prompt does not appear #12328

carlosala opened this issue Apr 6, 2024 · 18 comments
Assignees

Comments

@carlosala
Copy link
Member

carlosala commented Apr 6, 2024

Same problems as OP:

Before:

image

After:

image

theme: https://github.com/sobolevn/sobole-zsh-theme
zsh version: 5.9 (x86_64-debian-linux-gnu)
git version: 2.39.2
Debian GNU/Linux 12

Originally posted by @hwalinga in #12267 (comment)

@carlosala
Copy link
Member Author

I see, your theme uses a custom function print git information. We didn't take into account this situation. It's reproducible as well with minimal theme bundled in oh-my-zsh.

@carlosala
Copy link
Member Author

@mcornella we need to find a new way of discovering that it's indeed being used. Maybe with a fd or something like that?

@carlosala
Copy link
Member Author

#12327 reports exactly the same regression

@134130
Copy link

134130 commented Apr 6, 2024

FYI: The third-party plugin 'bullet-train' is also in the same problem.

@LockonS
Copy link

LockonS commented Apr 7, 2024

FYI: The third-party plugin 'bullet-train' is also in the same problem.

Encounter the same issue for bullet-train theme. There is a temporary work around for this.

# replace this line
BULLETTRAIN_GIT_PROMPT_CMD="\$(git_prompt_info)"
# to 
BULLETTRAIN_GIT_PROMPT_CMD="\$(_omz_git_prompt_info)"

Well this temporary fix only serves the basic usage, informations like status tracking with remote branch is not available.
There is a better temporary solution for the issue mentioned later in this thread: #12328 (comment)

@gelm0
Copy link

gelm0 commented Apr 8, 2024

For users using the minimal theme this is a workaround for displaying vcs info via git:

~/.oh-my-zsh/themes/minimal.zsh-theme

vcs_status() {
  if (( ${+functions[in_svn]} )) && in_svn; then
    svn_prompt_info
  elif (( ${+functions[in_hg]} )) && in_hg; then
    hg_prompt_info
  else
    _omz_git_prompt_info # https://github.com/ohmyzsh/ohmyzsh/issues/12328#issuecomment-2041350726
    #git_prompt_info <- old way of doing it
  fi
}

@dintz
Copy link

dintz commented Apr 8, 2024

FYI: The third-party plugin 'bullet-train' is also in the same problem.

Encounter the same issue for bullet-train theme. There is a temporary work around for this.

# replace this line
BULLETTRAIN_GIT_PROMPT_CMD="\$(git_prompt_info)"
# to 
BULLETTRAIN_GIT_PROMPT_CMD="\$(_omz_git_prompt_info)"

I have the same problem with bullet-train, but the workaround is helping for the meantime! Thx

@groud
Copy link

groud commented Apr 8, 2024

I have the same issue with the pygmalion theme, but it seems the workaround (replacing git_prompt_info by _omz_git_prompt_info) does not work for me.

@stevenharman
Copy link

I'm hitting something similar, and I believe related. I updated omz today and started seeing an errant then then in my prompt. After then upgrade:

My standard config, using a custom theme which relies on git_prompt_info:

zsh-async-git-asybc-enabled

If I switch git_prompt_info to use _omz_git_prompt_info, the then then no longer appear:

zsh-async-git-omz-status

Similarly, I can use the git_prompt_info as before, so long as I disable async-prompt via

zstyle ':omz:alpha:lib:git' async-prompt no

zsh-async-git-async-disabled

stevenharman added a commit to stevenharman/config that referenced this issue Apr 8, 2024
@mcornella
Copy link
Member

mcornella commented Apr 8, 2024

Hi folks! This is going to be the easiest temporary fix while we figure out a cleaner transition path for themes dependent on the current functions.

Setting the code below in your .zshrc file, before Oh My Zsh is sourced:

zstyle ':omz:alpha:lib:git' async-prompt no 

https://github.com/ohmyzsh/ohmyzsh?tab=readme-ov-file#disable-async-git-prompt

Keep an eye on this issue for updates on improvements!

@greenchapter
Copy link

Hi folks! This is going to be the easiest temporary fix while we figure out a cleaner transition path for themes dependent on the current functions.

Setting the code below in your .zshrc file, before Oh My Zsh is sourced:

zstyle ':omz:alpha:lib:git' async-prompt no 

https://github.com/ohmyzsh/ohmyzsh?tab=readme-ov-file#disable-async-git-prompt

Keep an eye on this issue for updates on improvements!

Unfortunately doesn't work for me 😞

@mcornella
Copy link
Member

Unfortunately doesn't work for me 😞

Did you put this line before the source $ZSH/oh-my-zsh.sh line?

@christian-heusel
Copy link

Unfortunately doesn't work for me 😞

Also you need to reload your shell 😊

@greenchapter
Copy link

Unfortunately doesn't work for me 😞

Did you put this line before the source $ZSH/oh-my-zsh.sh line?

Ah good hint, now it works 🙏

@greenchapter
Copy link

Unfortunately doesn't work for me 😞

Also you need to reload your shell 😊

Yes of course, I did it. Thank you 😀

stefanistrate added a commit to stefanistrate/dotfiles that referenced this issue Apr 16, 2024
nnorakk added a commit to nnorakk/dotfiles that referenced this issue Apr 19, 2024
Aparentemente apos uma atualizacao do oh-my-zsh as informacoes de git
exibidas no prompt dos temas passou a nao funcionar.

Nesse issue abaixo no repositorio eh mostrado um workaround
ohmyzsh/ohmyzsh#12328
@guydunigo
Copy link

guydunigo commented Apr 24, 2024

Hello,
To add on this issue, in lib/git.sh I see you only register the async function if you find find $(git_prompt_info) in PS1.
However, I wrap this text in another function that displays it conditionally so it doesn't directly appear in echo $PS1...

So I played dumb and added that after omz is loaded in my zshrc : export PROMPT="$PROMPT"'$(false $(git_prompt_info))'

And it works ! Now I can see the git prompt appear async (slightly after the rest).

Maybe it is a similar issue noted above. So it is probably the detection mechanism that should be changed.
Quick idea : try to expand PS1 before testing if git_prompt_info is in it.

Aadniz added a commit to Aadniz/bullet-train.zsh that referenced this issue May 4, 2024
@TsubasaEX
Copy link

TsubasaEX commented May 7, 2024

Have been encountering the same problem with theme "bullet-train".
There is no branch info attached in the prompt but just a flag icon.
I've tried zstyle ':omz:alpha:lib:git' async-prompt no and omz reload but it didn't work.

image

Will there be any updates to fix this?
Thank you.

@mcornella
Copy link
Member

That needs to be put in your .zshrc file, before Oh My Zsh is sourced. We are working on getting this right, as there is a current mitigation. Will update in here when we have a definitive fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Backlog
Development

No branches or pull requests